Files
nuzlocke-tracker/backend/src/app/schemas/pokemon.py
Julian Tabel ad1eb0524c Enforce Dupes Clause and Shiny Clause rules
Dupes Clause greys out Pokemon in the encounter modal whose evolution
family has already been caught, preventing duplicate selections. Shiny
Clause adds a dedicated Shiny Box and lets shiny catches bypass the
one-per-route lock via a new is_shiny column on encounters and a
/pokemon/families endpoint that computes evolution family groups.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 21:08:25 +01:00

144 lines
2.9 KiB
Python

from pydantic import BaseModel
from app.schemas.base import CamelModel
class PokemonResponse(CamelModel):
id: int
pokeapi_id: int
national_dex: int
name: str
types: list[str]
sprite_url: str | None
class PaginatedPokemonResponse(CamelModel):
items: list[PokemonResponse]
total: int
limit: int
offset: int
class EvolutionResponse(CamelModel):
id: int
from_pokemon_id: int
to_pokemon: PokemonResponse
trigger: str
min_level: int | None
item: str | None
held_item: str | None
condition: str | None
region: str | None
class FamiliesResponse(CamelModel):
families: list[list[int]]
class RouteEncounterResponse(CamelModel):
id: int
route_id: int
pokemon_id: int
encounter_method: str
encounter_rate: int
min_level: int
max_level: int
class RouteEncounterDetailResponse(RouteEncounterResponse):
pokemon: PokemonResponse
# --- Admin schemas ---
class PokemonCreate(CamelModel):
pokeapi_id: int
national_dex: int
name: str
types: list[str]
sprite_url: str | None = None
class PokemonUpdate(CamelModel):
pokeapi_id: int | None = None
national_dex: int | None = None
name: str | None = None
types: list[str] | None = None
sprite_url: str | None = None
class RouteEncounterCreate(CamelModel):
pokemon_id: int
encounter_method: str
encounter_rate: int
min_level: int
max_level: int
class RouteEncounterUpdate(CamelModel):
encounter_method: str | None = None
encounter_rate: int | None = None
min_level: int | None = None
max_level: int | None = None
class BulkImportItem(BaseModel):
pokeapi_id: int
national_dex: int
name: str
types: list[str]
sprite_url: str | None = None
class BulkImportResult(CamelModel):
created: int
updated: int
errors: list[str]
# --- Evolution admin schemas ---
class EvolutionAdminResponse(CamelModel):
id: int
from_pokemon_id: int
to_pokemon_id: int
from_pokemon: PokemonResponse
to_pokemon: PokemonResponse
trigger: str
min_level: int | None
item: str | None
held_item: str | None
condition: str | None
region: str | None
class PaginatedEvolutionResponse(CamelModel):
items: list[EvolutionAdminResponse]
total: int
limit: int
offset: int
class EvolutionCreate(CamelModel):
from_pokemon_id: int
to_pokemon_id: int
trigger: str
min_level: int | None = None
item: str | None = None
held_item: str | None = None
condition: str | None = None
region: str | None = None
class EvolutionUpdate(CamelModel):
from_pokemon_id: int | None = None
to_pokemon_id: int | None = None
trigger: str | None = None
min_level: int | None = None
item: str | None = None
held_item: str | None = None
condition: str | None = None
region: str | None = None