Add REST API endpoints for games, runs, and encounters

Implement 13 endpoints: read-only reference data (games, routes, pokemon),
run CRUD with cascading deletes, and encounter management. Uses Pydantic v2
with camelCase alias generation to match frontend types, and nested response
schemas for detail views.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Julian Tabel
2026-02-05 15:09:05 +01:00
parent cfd4c51514
commit 13e90eb308
12 changed files with 452 additions and 21 deletions

View File

@@ -1,11 +1,11 @@
---
# nuzlocke-tracker-bkhs
title: API Endpoints Implementation
status: todo
status: completed
type: task
priority: normal
created_at: 2026-02-04T15:46:59Z
updated_at: 2026-02-04T15:47:23Z
updated_at: 2026-02-05T13:47:57Z
parent: nuzlocke-tracker-f5ob
blocking:
- nuzlocke-tracker-8fcj
@@ -15,24 +15,24 @@ blocking:
Implement the REST/GraphQL API endpoints for the tracker.
## Checklist
- [ ] Reference Data endpoints (read-only for tracker):
- [ ] GET /api/games - List all games
- [ ] GET /api/games/:id - Get game details with routes
- [ ] GET /api/games/:id/routes - List routes for a game
- [ ] GET /api/routes/:id/pokemon - List available Pokémon for a route
- [ ] GET /api/pokemon/:id - Get Pokémon details
- [ ] Run Management endpoints:
- [ ] POST /api/runs - Create new run
- [ ] GET /api/runs - List all runs
- [ ] GET /api/runs/:id - Get run details with encounters
- [ ] PATCH /api/runs/:id - Update run (settings, status)
- [ ] DELETE /api/runs/:id - Delete a run
- [ ] Encounter endpoints:
- [ ] POST /api/runs/:id/encounters - Log new encounter
- [ ] PATCH /api/encounters/:id - Update encounter (status, nickname)
- [ ] DELETE /api/encounters/:id - Remove encounter
- [ ] Add request validation
- [ ] Add proper error responses
- [x] Reference Data endpoints (read-only for tracker):
- [x] GET /api/v1/games - List all games
- [x] GET /api/v1/games/:id - Get game details with routes
- [x] GET /api/v1/games/:id/routes - List routes for a game
- [x] GET /api/v1/routes/:id/pokemon - List available Pokémon for a route
- [x] GET /api/v1/pokemon/:id - Get Pokémon details
- [x] Run Management endpoints:
- [x] POST /api/v1/runs - Create new run
- [x] GET /api/v1/runs - List all runs
- [x] GET /api/v1/runs/:id - Get run details with encounters
- [x] PATCH /api/v1/runs/:id - Update run (settings, status)
- [x] DELETE /api/v1/runs/:id - Delete a run
- [x] Encounter endpoints:
- [x] POST /api/v1/runs/:id/encounters - Log new encounter
- [x] PATCH /api/v1/encounters/:id - Update encounter (status, nickname)
- [x] DELETE /api/v1/encounters/:id - Remove encounter
- [x] Add request validation
- [x] Add proper error responses
## Notes
- Follow REST conventions