Backend: GET /api/playouts/{id}/items endpoint #101

Closed
opened 2026-07-02 19:44:02 +02:00 by timothy · 2 comments
Owner

From the ChicoryTV plan audit (epic #59, 2026-07-02).

The Playouts screen (#87) renders a timeline strip, now/next hero, and upcoming list from playout items — none of which have a REST source. The internal GetFuturePlayoutItemsById query already returns Title/Start/Finish/Duration/FillerKind, supports showFiller + paging, and folds gaps in as UNSCHEDULED. Blazor-only today.

Scope

  • Add GET /api/playouts/{id}/items?showFiller=&pageNum=&pageSize= exposing GetFuturePlayoutItemsById.
  • Response DTO under ErsatzTV.Core/Api/Playouts/ with start/finish/title/duration/fillerKind.
  • Regenerate OpenAPI + SPA types.

Now-item selection ("Start <= now < Finish"), progress %, and "started Xm ago / Ym to next" are client-side derivations on top of this — no extra API needed.

Unblocks: #87 timeline strip, NOW hero, up-next card, upcoming list, show-filler toggle.
Hard-blocks #87. Effort: S.

From the ChicoryTV plan audit (epic #59, 2026-07-02). The Playouts screen (#87) renders a timeline strip, now/next hero, and upcoming list from playout items — none of which have a REST source. The internal `GetFuturePlayoutItemsById` query already returns Title/Start/Finish/Duration/FillerKind, supports `showFiller` + paging, and folds gaps in as UNSCHEDULED. Blazor-only today. **Scope** - Add `GET /api/playouts/{id}/items?showFiller=&pageNum=&pageSize=` exposing `GetFuturePlayoutItemsById`. - Response DTO under `ErsatzTV.Core/Api/Playouts/` with start/finish/title/duration/fillerKind. - Regenerate OpenAPI + SPA types. Now-item selection ("Start <= now < Finish"), progress %, and "started Xm ago / Ym to next" are client-side derivations on top of this — no extra API needed. **Unblocks:** #87 timeline strip, NOW hero, up-next card, upcoming list, show-filler toggle. **Hard-blocks #87.** Effort: S.
timothy added the enhancementapi labels 2026-07-02 19:44:02 +02:00
timothy added a new dependency 2026-07-02 19:44:15 +02:00
Author
Owner

Working on this via branch feat/playouts-read-api. Recon of WIP 49a6d4ee: GET /api/playouts/{id}/items exposes GetFuturePlayoutItemsById with showFiller/pageNum/pageSize. Found a compile error in the item projection: Option<FillerKind>.ToNullable() does not exist — fixing with a null-safe conversion (avoiding the LanguageExt Match-returns-null trap that bit the #108 WIP). Also verifying whether an unknown playout id should 404 per REST conventions; will state the decision in the PR.

Working on this via branch `feat/playouts-read-api`. Recon of WIP 49a6d4ee: GET /api/playouts/{id}/items exposes GetFuturePlayoutItemsById with showFiller/pageNum/pageSize. Found a compile error in the item projection: `Option<FillerKind>.ToNullable()` does not exist — fixing with a null-safe conversion (avoiding the LanguageExt Match-returns-null trap that bit the #108 WIP). Also verifying whether an unknown playout id should 404 per REST conventions; will state the decision in the PR.
Author
Owner

Closed via PR #116. GET /api/playouts/{id}/items exposes GetFuturePlayoutItemsById (showFiller/pageNum/pageSize); items carry start/finish/title/duration and nullable fillerKind (null = unscheduled gap). Deviation from WIP: unknown playout id now returns 404 ProblemDetails (ScheduleController /items precedent + docs/rest-api.md explicit-over-silent), with an OpenApiErrorResponseContractTests entry. Root cause of the WIP compile error: Option.ToNullable() does not exist in this LanguageExt version — fixed with MatchUnsafe (Health/Mapper.cs idiom; plain Match throws ResultIsNullException on a null branch). Merged via PR #116 (commit 20ca71b3, squashed from salvaged WIP 49a6d4ee, rebased onto main). Build 0 errors; TZ=UTC tests 289/289 green; OpenAPI regenerated via scripts/update-openapi.sh. Adversarial (fable) review verdict FIX-FIRST → fixed before merge: DTO files lacked #nullable enable so the spec wrongly documented buildStatus/scheduleFile as non-nullable (would have broken SPA typegen). Deferred: the 404 pre-check reuses GetPlayoutById (3 Includes) — a lightweight exists-check query is a possible follow-up.

**Closed via PR #116.** GET /api/playouts/{id}/items exposes GetFuturePlayoutItemsById (showFiller/pageNum/pageSize); items carry start/finish/title/duration and nullable fillerKind (null = unscheduled gap). Deviation from WIP: unknown playout id now returns 404 ProblemDetails (ScheduleController /items precedent + docs/rest-api.md explicit-over-silent), with an OpenApiErrorResponseContractTests entry. Root cause of the WIP compile error: Option<FillerKind>.ToNullable() does not exist in this LanguageExt version — fixed with MatchUnsafe (Health/Mapper.cs idiom; plain Match throws ResultIsNullException on a null branch). Merged via PR #116 (commit 20ca71b3, squashed from salvaged WIP 49a6d4ee, rebased onto main). Build 0 errors; TZ=UTC tests 289/289 green; OpenAPI regenerated via scripts/update-openapi.sh. Adversarial (fable) review verdict FIX-FIRST → fixed before merge: DTO files lacked #nullable enable so the spec wrongly documented buildStatus/scheduleFile as non-nullable (would have broken SPA typegen). Deferred: the 404 pre-check reuses GetPlayoutById (3 Includes) — a lightweight exists-check query is a possible follow-up.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Blocks
Reference: timothy/ersatztv#101