Add movies/series filmography to company detail
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

GET /companies/{id} showed only the company's own info. Adds movies
and series lists (any role: production, distribution, network),
ordered by release/first-air date, read straight off the existing
movie_companies/series_companies junction rows -- no separate sync
needed since those only ever exist as a side effect of ingesting the
movie or series itself.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
NixReaper
2026-09-05 09:34:31 -05:00
co-authored by Claude Sonnet 5
parent 606d2532c4
commit 6956bf7406
6 changed files with 144 additions and 2 deletions
+25 -1
View File
@@ -7,9 +7,33 @@ import uuid
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from app.models.company import Company
from app.models.company import Company, MovieCompany, SeriesCompany
from app.models.movie import Movie
from app.models.tv import Series
async def get_company_by_id(session: AsyncSession, company_id: uuid.UUID) -> Company | None:
result = await session.execute(select(Company).where(Company.id == company_id))
return result.scalar_one_or_none()
async def get_company_movies(session: AsyncSession, company_id: uuid.UUID) -> list[Movie]:
stmt = (
select(Movie)
.join(MovieCompany, MovieCompany.movie_id == Movie.id)
.where(MovieCompany.company_id == company_id)
.order_by(Movie.primary_release_date.asc().nulls_last())
)
result = await session.execute(stmt)
return list(result.scalars().all())
async def get_company_series(session: AsyncSession, company_id: uuid.UUID) -> list[Series]:
stmt = (
select(Series)
.join(SeriesCompany, SeriesCompany.series_id == Series.id)
.where(SeriesCompany.company_id == company_id)
.order_by(Series.first_air_date.asc().nulls_last())
)
result = await session.execute(stmt)
return list(result.scalars().all())