Add filter controls to admin tables

Pokemon (type), Evolutions (trigger), Games (region/generation),
and Runs (status/game) now have dropdown filters alongside search.
Server-side filtering for paginated tables, client-side for small datasets.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-08 20:29:55 +01:00
parent 5d444f0c91
commit c6521dd206
9 changed files with 188 additions and 20 deletions

View File

@@ -32,6 +32,7 @@ router = APIRouter()
@router.get("/pokemon", response_model=PaginatedPokemonResponse)
async def list_pokemon(
search: str | None = Query(None),
type: str | None = Query(None),
limit: int = Query(50, ge=1, le=500),
offset: int = Query(0, ge=0),
session: AsyncSession = Depends(get_session),
@@ -42,6 +43,8 @@ async def list_pokemon(
base_query = base_query.where(
func.lower(Pokemon.name).contains(search.lower())
)
if type:
base_query = base_query.where(Pokemon.types.any(type))
# Get total count
count_query = select(func.count()).select_from(base_query.subquery())