Add GET /movies and GET /series browse/discover endpoints
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

The complement to /search for browsing without a query: paginated,
filterable (genre, year, status) and sortable (popularity,
release/air date, rating, title) listings. Offset-based pagination
rather than the Aurora ID cursor scheme, since sorting by
popularity/rating/date doesn't line up with creation-order cursors.

Total count is computed via a window function in the same query as
the page of results, avoiding a second round trip per request. An
invalid filter (malformed genre id, unknown status) is a 422 via a
per-service InvalidMovieFilterError/InvalidSeriesFilterError, caught
before any DB query runs.

build_movie_summary/build_series_summary refactored to share their
row-to-summary logic with the new list path, avoiding a redundant
get_by_id lookup when the row is already in hand.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
NixReaper
2026-09-05 09:01:11 -05:00
co-authored by Claude Sonnet 5
parent 892f78016c
commit 20f5e82d1b
11 changed files with 798 additions and 24 deletions
+35 -4
View File
@@ -43,12 +43,32 @@ GET /api/v1/search?q=the%20matrix
| Method | Path |
|---|---|
| GET | `/api/v1/movies` |
| GET | `/api/v1/movies/{aurora_id}` |
| GET | `/api/v1/movies/{aurora_id}/credits` |
| GET | `/api/v1/movies/{aurora_id}/images` |
| GET | `/api/v1/movies/{aurora_id}/videos` |
| GET | `/api/v1/movies/{aurora_id}/recommendations` |
`GET /api/v1/movies` browses/discovers without a search query — the
complement to `/search` (section 17, additive beyond the spec's minimum
endpoint list). Query params: `genre` (an Aurora genre id), `year`
(primary release year), `status` (e.g. `released`), `sort_by`
(`popularity` default | `release_date` | `vote_average` | `title`),
`sort_dir` (`desc` default | `asc`), `page` (default 1), `page_size`
(default 20, max 50). An invalid filter value (a malformed genre id, an
unknown status) is a 422, not a silently-empty result. Response:
```json
{
"page": 1,
"page_size": 20,
"total_results": 142,
"total_pages": 8,
"results": [ { "id": "aur_movie_...", "type": "movie", "title": "The Matrix", "release_date": "1999-03-30", "poster_path": "https://...", "popularity": 45.5, "vote_average": 8.2 } ]
}
```
`GET /api/v1/movies/{aurora_id}` (cached, see `docs/architecture.md#caching`):
```json
@@ -103,11 +123,18 @@ ingested:
| Method | Path |
|---|---|
| GET | `/api/v1/series` |
| GET | `/api/v1/series/{aurora_id}` |
| GET | `/api/v1/series/{aurora_id}/seasons` |
| GET | `/api/v1/seasons/{aurora_id}` |
| GET | `/api/v1/episodes/{aurora_id}` |
`GET /api/v1/series` is the series equivalent of `GET /api/v1/movies`
above, with `sort_by` values `popularity` (default) | `first_air_date` |
`vote_average` | `title` (`release_date`/`year` become `first_air_date`/
`year` filtered against it) — otherwise the same params, response shape,
and validation behavior.
Series detail includes `networks` and `companies` as separate lists (a TV
network and a production company are both `Company` rows distinguished by
`company_type` — see `docs/database.md`), plus `creators` (series-level
@@ -160,10 +187,14 @@ you want network-level isolation too.
## Known limitations
- No pagination on list-shaped responses yet beyond search's `limit`
(movie/series lists like recommendations return everything). Cursor-based
pagination using the Aurora ID's inherent creation-order sort (see
`docs/database.md#aurora-ids-vs-primary-keys`) is the natural next step.
- `GET /movies` and `GET /series` (browse/discover) paginate with
`page`/`page_size`, offset-based rather than the Aurora ID cursor scheme
`docs/database.md#aurora-ids-vs-primary-keys` describes, since sorting by
popularity/rating/date doesn't line up with creation-order cursors. Other
list-shaped responses (recommendations, a collection's `movies`, a
person's `credits`) still return everything with no pagination at all —
fine at today's scale, but the natural next thing to revisit if any of
them grow large.
- `/people/{id}/credits` covers movies and series (episode guest-star
credits rolled up per series). It does not yet expose a per-episode
breakdown for those guest appearances (just the aggregate