feat(api): GET /api/collections/{id}/items (paged) — full collection contents (#155) #189

Merged
timothy merged 3 commits from feat/collections-api into main 2026-07-08 18:38:25 +02:00
Owner

Adds a paged GET /api/collections/{id}/items so the SPA can enumerate a manual collection's FULL contents (all media kinds), replacing the lossy Lucene name-based preview (which only covered Movie/Show/Season/Artist). Closes #155.

  • New GetCollectionItems query/handler: loads the collection (missing → NotFoundError/404), hydrates its CollectionItems via a new shared LibraryBrowseItemMapper (extracted from GetLibraryBrowseItemsHandler — one copy of the per-kind projection + rooted-artwork rules per api-conventions §4; browse handler behavior unchanged), orders by title, pages in-memory with LogsController-style clamping.
  • Reuses PagedLibraryBrowseItemsResponseModel / LibraryBrowseItemResponseModel — the SPA already consumes LibraryBrowseItem, so the client swap is a drop-in.
  • POST-500 sub-item confirmed already fixed (not reproducible): AddItemsToCollectionHandler.ValidateMediaItems (fb3f2856) returns 422 for any bogus id and 404 for a missing collection; existing handler/controller/contract tests already cover it. No validation re-added.
  • SPA: getCollectionItems(id,page) added; CollectionsScreen items view now uses the real endpoint with a Load-more pager; honest-banner caveat + getCollectionItemsPreview removed.
  • Controller + handler + contract tests added; OpenAPI regenerated (endpoint-index +1 op); docs/blazor-route-parity.md marks #155 resolved.

Verified (post-merge-of-main): ErsatzTV.Tests 833 green, web typecheck+lint+build+vitest 330 green. v1.d.ts unchanged (both response schemas pre-existed) — npm run check:api passes.

fixes #155

🤖 Generated with Claude Code

Adds a paged `GET /api/collections/{id}/items` so the SPA can enumerate a manual collection's FULL contents (all media kinds), replacing the lossy Lucene name-based preview (which only covered Movie/Show/Season/Artist). Closes #155. - New `GetCollectionItems` query/handler: loads the collection (missing → NotFoundError/404), hydrates its `CollectionItems` via a new shared `LibraryBrowseItemMapper` (extracted from `GetLibraryBrowseItemsHandler` — one copy of the per-kind projection + rooted-artwork rules per api-conventions §4; browse handler behavior unchanged), orders by title, pages in-memory with LogsController-style clamping. - Reuses `PagedLibraryBrowseItemsResponseModel` / `LibraryBrowseItemResponseModel` — the SPA already consumes `LibraryBrowseItem`, so the client swap is a drop-in. - **POST-500 sub-item confirmed already fixed** (not reproducible): `AddItemsToCollectionHandler.ValidateMediaItems` (fb3f2856) returns 422 for any bogus id and 404 for a missing collection; existing handler/controller/contract tests already cover it. No validation re-added. - SPA: `getCollectionItems(id,page)` added; `CollectionsScreen` items view now uses the real endpoint with a Load-more pager; honest-banner caveat + `getCollectionItemsPreview` removed. - Controller + handler + contract tests added; OpenAPI regenerated (endpoint-index +1 op); `docs/blazor-route-parity.md` marks #155 resolved. Verified (post-merge-of-main): `ErsatzTV.Tests` 833 green, web typecheck+lint+build+vitest 330 green. v1.d.ts unchanged (both response schemas pre-existed) — `npm run check:api` passes. fixes #155 🤖 Generated with [Claude Code](https://claude.com/claude-code)
timothy added 3 commits 2026-07-08 18:28:38 +02:00
Adds a paged collection-items endpoint reusing LibraryBrowseItemResponseModel
so the SPA lists a manual collection's full contents (all media kinds), replacing
the lossy Lucene name-based preview. Confirms POST /items already returns 422 for
bogus ids (guarded by ValidateMediaItems, fb3f2856); adds endpoint-level coverage.

fixes #155

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
docs: regenerate endpoint-index after merging main (includes GET collection items) (#155)
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 4m27s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 4m45s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
cf85bf3093
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
timothy merged commit ca1265214e into main 2026-07-08 18:38:25 +02:00
Sign in to join this conversation.