Add non-evolution form change support (Rotom, Oricorio, etc.)
Add a "Change Form" button in StatusChangeModal for Pokemon with alternate forms sharing the same national_dex number. Mirrors the existing evolution UI pattern, reusing currentPokemonId to track the active form. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -158,6 +158,22 @@ async def get_pokemon(
|
||||
return pokemon
|
||||
|
||||
|
||||
@router.get("/pokemon/{pokemon_id}/forms", response_model=list[PokemonResponse])
|
||||
async def get_pokemon_forms(
|
||||
pokemon_id: int, session: AsyncSession = Depends(get_session)
|
||||
):
|
||||
pokemon = await session.get(Pokemon, pokemon_id)
|
||||
if pokemon is None:
|
||||
raise HTTPException(status_code=404, detail="Pokemon not found")
|
||||
|
||||
result = await session.execute(
|
||||
select(Pokemon)
|
||||
.where(Pokemon.national_dex == pokemon.national_dex, Pokemon.id != pokemon_id)
|
||||
.order_by(Pokemon.pokeapi_id)
|
||||
)
|
||||
return result.scalars().all()
|
||||
|
||||
|
||||
@router.get("/pokemon/{pokemon_id}/evolutions", response_model=list[EvolutionResponse])
|
||||
async def get_pokemon_evolutions(
|
||||
pokemon_id: int,
|
||||
|
||||
Reference in New Issue
Block a user