Add version groups to share routes and boss battles across games
Routes and boss battles now belong to a version_group instead of individual games, so paired versions (e.g. Red/Blue, Gold/Silver) share the same route structure and boss battles. Route encounters gain a game_id column to support game-specific encounter tables within a shared route. Includes migration, updated seeds, API changes, and frontend type updates. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -256,19 +256,25 @@ async def delete_pokemon(
|
||||
response_model=list[RouteEncounterDetailResponse],
|
||||
)
|
||||
async def list_route_encounters(
|
||||
route_id: int, session: AsyncSession = Depends(get_session)
|
||||
route_id: int,
|
||||
game_id: int | None = Query(None),
|
||||
session: AsyncSession = Depends(get_session),
|
||||
):
|
||||
# Verify route exists
|
||||
route = await session.get(Route, route_id)
|
||||
if route is None:
|
||||
raise HTTPException(status_code=404, detail="Route not found")
|
||||
|
||||
result = await session.execute(
|
||||
query = (
|
||||
select(RouteEncounter)
|
||||
.where(RouteEncounter.route_id == route_id)
|
||||
.options(joinedload(RouteEncounter.pokemon))
|
||||
.order_by(RouteEncounter.encounter_rate.desc())
|
||||
)
|
||||
if game_id is not None:
|
||||
query = query.where(RouteEncounter.game_id == game_id)
|
||||
|
||||
result = await session.execute(query)
|
||||
return result.scalars().unique().all()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user