Add GET /movies/{id}/recommendations
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
Ingestion already stored movie_recommendations edges from TMDb's recommendations list (linking only to movies already ingested into Aurora, per the never-fabricate-a-stub rule), but nothing exposed them. Adds the repository lookup, service assembly, and route to read them back in ranked order. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
73488a0d80
commit
4af4ba40ef
@@ -14,6 +14,7 @@ from app.schemas.movie import (
|
||||
MovieCreditsOut,
|
||||
MovieDetailOut,
|
||||
MovieImagesOut,
|
||||
MovieRecommendationsOut,
|
||||
MovieSummaryOut,
|
||||
MovieVideosOut,
|
||||
)
|
||||
@@ -123,6 +124,18 @@ async def get_movie_videos(session: AsyncSession, movie_aurora_id: str) -> Movie
|
||||
return MovieVideosOut(id=aurora_id("movie", str(movie.id)), videos=[to_video_out(v) for v in videos])
|
||||
|
||||
|
||||
async def get_movie_recommendations(
|
||||
session: AsyncSession, movie_aurora_id: str
|
||||
) -> MovieRecommendationsOut:
|
||||
movie_id = await _resolve_movie_id(movie_aurora_id)
|
||||
movie = await movie_repository.get_movie_by_id(session, movie_id)
|
||||
if movie is None:
|
||||
raise MovieNotFoundError(movie_aurora_id)
|
||||
recommended_ids = await movie_repository.get_movie_recommendation_ids(session, movie_id)
|
||||
summaries = await build_movie_summaries(session, recommended_ids)
|
||||
return MovieRecommendationsOut(id=aurora_id("movie", str(movie.id)), recommendations=summaries)
|
||||
|
||||
|
||||
async def build_movie_summary(session: AsyncSession, movie_id: uuid.UUID) -> MovieSummaryOut | None:
|
||||
movie = await movie_repository.get_movie_by_id(session, movie_id)
|
||||
if movie is None:
|
||||
|
||||
Reference in New Issue
Block a user