Add GET /collections browse endpoint; fix embedded collection poster_path
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

Completes browse/discover across all five entity types: movies, series,
people, companies, and now collections. No filter (no categorical field
like company_type exists for a collection) -- just page/page_size,
always alphabetical by name.

While adding poster_path to CollectionBriefOut for the browse listing,
found the same class of bug fixed earlier for company logo_path:
movie_service's embedded `collection` field never looked up its poster
artwork either, so it stayed null even after ingest_collection populated
one. Fixed alongside since it's the same schema field this feature was
already touching.

Also removed PageMeta from schemas/common.py -- scaffolding from early
spec work that was never actually wired into any endpoint; all five
browse endpoints shipped this session use a flat page/page_size/
total_results/total_pages shape instead.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
NixReaper
2026-09-05 20:08:26 -05:00
co-authored by Claude Sonnet 5
parent 4cf3556433
commit f1ac072794
9 changed files with 184 additions and 21 deletions
+26 -1
View File
@@ -21,8 +21,10 @@ from app.models.movie import Movie
from app.models.provider import ProviderRecord
from app.providers.base import MetadataProvider
from app.services import movie_service
from app.services.ingestion.collection_ingestion import ingest_collection
from app.services.ingestion.movie_ingestion import ingest_movie
from tests.unit.test_normalizer import FAKE_MOVIE
from tests.integration.test_collection_ingestion import FakeTMDbCollectionProvider
from tests.unit.test_normalizer import FAKE_COLLECTION, FAKE_MOVIE
class FakeTMDbProvider(MetadataProvider):
@@ -154,6 +156,29 @@ async def test_movie_detail_surfaces_company_logo_path(db_session: AsyncSession)
assert roadshow.logo_path.endswith("/village-roadshow-logo.png")
@pytest.mark.asyncio
async def test_movie_detail_surfaces_collection_poster_path(db_session: AsyncSession):
"""Same class of bug as company logo_path: movie_service built the
embedded collection field without ever looking up its poster artwork,
so poster_path stayed None even after a full ingest_collection run
populated one. The bare belongs_to_collection stub created by
ingest_movie alone has no poster -- only ingest_collection provides it."""
provider = FakeTMDbCollectionProvider(
movie_payloads={"603": FAKE_MOVIE}, collection_payload=FAKE_COLLECTION
)
movie_id = await ingest_movie(db_session, provider, "603")
await db_session.flush()
await ingest_collection(db_session, provider, "2344")
await db_session.commit()
detail = await movie_service.get_movie_detail(db_session, aurora_id("movie", str(movie_id)))
assert detail.collection is not None
assert detail.collection.poster_path is not None
assert detail.collection.poster_path.endswith("/collection-poster.jpg")
@pytest.mark.asyncio
async def test_movie_recommendations_only_include_already_ingested_movies(
db_session: AsyncSession,