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

@@ -0,0 +1,36 @@
from datetime import datetime
from app.schemas.base import CamelModel
from app.schemas.game import RouteResponse
from app.schemas.pokemon import PokemonResponse
class EncounterCreate(CamelModel):
route_id: int
pokemon_id: int
nickname: str | None = None
status: str
catch_level: int | None = None
class EncounterUpdate(CamelModel):
nickname: str | None = None
status: str | None = None
faint_level: int | None = None
class EncounterResponse(CamelModel):
id: int
run_id: int
route_id: int
pokemon_id: int
nickname: str | None
status: str
catch_level: int | None
faint_level: int | None
caught_at: datetime
class EncounterDetailResponse(EncounterResponse):
pokemon: PokemonResponse
route: RouteResponse