feat(api): filler/watermark/graphics list endpoints (#105) #113

Merged
timothy merged 3 commits from feat/105-picker-list-endpoints into main 2026-07-02 22:35:31 +02:00
Owner

Fixes #105.

Summary

Read-only list endpoints so the ChicoryTV SPA schedule-editor and channel pickers (#86, #89) can populate their dropdowns:

  • GET /api/filler-presets
  • GET /api/watermarks
  • GET /api/graphics-elements

Each returns a lightweight (Id, Name) response model — exactly what the Blazor pickers consume — instead of the full 15+-field ViewModels, keeping the OpenAPI surface clean. Graphics elements reuse ProjectToViewModel so API names match the Blazor display names, and reproduce the existing ordering rule (named elements before file-name-only ones).

Built on the salvaged WIP commit: reviewed against conventions, added route Name= attributes, handler tests (InMemoryTvContext harness: seeding, DTO projection, empty-DB, graphics ordering), and OpenAPI regen. TZ=UTC dotnet test ErsatzTV.Tests → 270 passed.

Review

Adversarial review of the full diff vs main: no blockers/majors.

  • MINOR (parity by design): filler-preset and watermark lists return DB order (no OrderBy(Name)), same as the Blazor handlers; SPA should client-sort if it cares.
  • The optional languages-list endpoint from the issue is deferred to a follow-up.
  • No model/migration changes; migrations job unaffected.

🤖 Generated with Claude Code

Fixes #105. ## Summary Read-only list endpoints so the ChicoryTV SPA schedule-editor and channel pickers (#86, #89) can populate their dropdowns: - `GET /api/filler-presets` - `GET /api/watermarks` - `GET /api/graphics-elements` Each returns a lightweight `(Id, Name)` response model — exactly what the Blazor pickers consume — instead of the full 15+-field ViewModels, keeping the OpenAPI surface clean. Graphics elements reuse `ProjectToViewModel` so API names match the Blazor display names, and reproduce the existing ordering rule (named elements before file-name-only ones). Built on the salvaged WIP commit: reviewed against conventions, added route `Name=` attributes, handler tests (InMemoryTvContext harness: seeding, DTO projection, empty-DB, graphics ordering), and OpenAPI regen. `TZ=UTC dotnet test ErsatzTV.Tests` → 270 passed. ## Review Adversarial review of the full diff vs main: no blockers/majors. - MINOR (parity by design): filler-preset and watermark lists return DB order (no `OrderBy(Name)`), same as the Blazor handlers; SPA should client-sort if it cares. - The optional languages-list endpoint from the issue is deferred to a follow-up. - No model/migration changes; migrations job unaffected. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
timothy added 3 commits 2026-07-02 22:09:51 +02:00
Untrusted draft — no build/test had run yet. Review before building on it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The WIP GET /api/filler-presets, /api/watermarks, and
/api/graphics-elements endpoints omitted the Name= route attribute
used by the other API GET actions (e.g. FFmpegProfileController). Add
Name = "GetFillerPresets" / "GetWatermarks" / "GetGraphicsElements" for
consistency.

Also add handler tests (FillerPresetHandlerTests, WatermarkHandlerTests,
GraphicsElementHandlerTests) covering the GetAll*ForApi handlers using
the InMemoryTvContext harness: multi-row projection to (Id, Name) DTOs,
the empty-DB case, and the graphics-element ordering rule (named
elements sort before elements whose projected Name equals FileName).
chore(openapi): regenerate v1.json for picker list endpoints (#105)
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 3m45s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 4m47s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
446f50763a
Adds /api/filler-presets, /api/watermarks, and /api/graphics-elements
to the published OpenAPI document via ./scripts/update-openapi.sh.
timothy merged commit 86f07594e4 into main 2026-07-02 22:35:31 +02:00
Sign in to join this conversation.