Add keyword browsing/filtering and expose alternate titles
CI / lint (push) Canceled after 0s
CI / typecheck (push) Canceled after 0s
CI / unit-tests (push) Canceled after 0s
CI / integration-tests (push) Canceled after 0s
CI / container-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
CI / lint (push) Canceled after 0s
CI / typecheck (push) Canceled after 0s
CI / unit-tests (push) Canceled after 0s
CI / integration-tests (push) Canceled after 0s
CI / container-build (push) Canceled after 0s
CI / dependency-audit (push) Canceled after 0s
Keywords were ingested and shown read-only on detail pages, but had no
directory (GET /keywords) or filter param -- the same gap genres had
before today. Mirrors the genre browse pattern exactly: repository,
service, route, plus a `keyword` filter on GET /movies and GET /series.
Alternate/translated titles ("Also Known As") were normalized down to
bare title strings and never written to MovieAlternateTitle/
SeriesAlternateTitle at all. Normalizer now captures country_code + type
per TMDb's actual shape; ingestion writes them; movie/series detail now
expose an alternate_titles list.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
e1a36ce227
commit
567b4ef068
@@ -0,0 +1,24 @@
|
||||
"""Keyword endpoints (section 17: additive) -- a directory for the
|
||||
`keyword` filter GET /movies and GET /series accept, with no prior way to
|
||||
discover what those ids are. Mirrors app/api/v1/genres.py exactly."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi import APIRouter, Depends, Query
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.core.database import get_db
|
||||
from app.core.security import enforce_rate_limit
|
||||
from app.schemas.common import KeywordListOut
|
||||
from app.services import keyword_service
|
||||
|
||||
router = APIRouter(prefix="/keywords", tags=["keywords"], dependencies=[Depends(enforce_rate_limit)])
|
||||
|
||||
|
||||
@router.get("", response_model=KeywordListOut)
|
||||
async def list_keywords(
|
||||
page: int = Query(1, ge=1),
|
||||
page_size: int = Query(50, ge=1, le=200),
|
||||
session: AsyncSession = Depends(get_db),
|
||||
) -> KeywordListOut:
|
||||
return await keyword_service.list_keywords(session, page=page, page_size=page_size)
|
||||
@@ -29,6 +29,7 @@ router = APIRouter(prefix="/movies", tags=["movies"], dependencies=[Depends(enfo
|
||||
@router.get("", response_model=MovieListOut)
|
||||
async def list_movies(
|
||||
genre: str | None = Query(None, description="Aurora genre id, e.g. aur_genre_..."),
|
||||
keyword: str | None = Query(None, description="Aurora keyword id, e.g. aur_keyword_..."),
|
||||
year: int | None = Query(None, description="Primary release year"),
|
||||
status_: str | None = Query(None, alias="status", description="Movie status, e.g. released"),
|
||||
sort_by: Literal["popularity", "release_date", "vote_average", "title"] = Query("popularity"),
|
||||
@@ -41,6 +42,7 @@ async def list_movies(
|
||||
return await movie_service.list_movies(
|
||||
session,
|
||||
genre_aurora_id=genre,
|
||||
keyword_aurora_id=keyword,
|
||||
year=year,
|
||||
status=status_,
|
||||
sort_by=sort_by,
|
||||
|
||||
@@ -29,6 +29,7 @@ router = APIRouter(prefix="/series", tags=["series"], dependencies=[Depends(enfo
|
||||
@router.get("", response_model=SeriesListOut)
|
||||
async def list_series(
|
||||
genre: str | None = Query(None, description="Aurora genre id, e.g. aur_genre_..."),
|
||||
keyword: str | None = Query(None, description="Aurora keyword id, e.g. aur_keyword_..."),
|
||||
year: int | None = Query(None, description="First air date year"),
|
||||
status_: str | None = Query(None, alias="status", description="Series status, e.g. ended"),
|
||||
sort_by: Literal["popularity", "first_air_date", "vote_average", "title"] = Query("popularity"),
|
||||
@@ -41,6 +42,7 @@ async def list_series(
|
||||
return await tv_service.list_series(
|
||||
session,
|
||||
genre_aurora_id=genre,
|
||||
keyword_aurora_id=keyword,
|
||||
year=year,
|
||||
status=status_,
|
||||
sort_by=sort_by,
|
||||
|
||||
Reference in New Issue
Block a user