Slice S5 of the #162 scheduling REST plan (parity issue #144): fixes the disabled Add Playout button.
API
POST /api/playouts now creates playouts of all 5 schedule kinds via a scheduleKind discriminator on CreatePlayoutRequest (programScheduleId now nullable; new scheduleFile). Per-kind validation → 422: Classic requires programScheduleId, Sequential/Scripted/ExternalJson require scheduleFile, Block requires neither.
New PUT /api/playouts/{id}: updates dailyRebuildTime (null clears — mirrors Blazor's "Do not automatically reset") and scheduleFile (Sequential/Scripted/ExternalJson only, else 422). 404 via pre-check (UpdatePlayoutHandler's own not-found is a plain BaseError → would be 422; follow-up candidate).
ErsatzTV.Tests 621 green; Core.Tests 493 green (+1 skip); web 218 green; tsc + vite build clean.
Live E2E (scratch config, real browser): all create/update/validation paths (201/422/404) + both dialogs exercised; screenshots taken. Sequential create only checks file existence (parity with Blazor) — bogus YAML fails later at build time, as upstream.
Part of #144 / #162 (slice S5 — do not auto-close).
Slice S5 of the #162 scheduling REST plan (parity issue #144): fixes the disabled Add Playout button.
**API**
- `POST /api/playouts` now creates playouts of **all 5 schedule kinds** via a `scheduleKind` discriminator on `CreatePlayoutRequest` (`programScheduleId` now nullable; new `scheduleFile`). Per-kind validation → 422: Classic requires `programScheduleId`, Sequential/Scripted/ExternalJson require `scheduleFile`, Block requires neither.
- New `PUT /api/playouts/{id}`: updates `dailyRebuildTime` (null clears — mirrors Blazor's "Do not automatically reset") and `scheduleFile` (Sequential/Scripted/ExternalJson only, else 422). 404 via pre-check (`UpdatePlayoutHandler`'s own not-found is a plain BaseError → would be 422; follow-up candidate).
- `ApiErrorResponseMetadataTests` + `PlayoutControllerTests` extended; OpenAPI spec regenerated.
**SPA**
- `createPlayout()` / `updatePlayoutDetails()` in `web/src/api/playouts.ts` + URL-assert tests.
- Add Playout dialog (kind select, channel select annotating channels that already have a playout, classic schedule picker, schedule-file input with Blazor helper texts).
- "Edit details" dialog on the playout card (half-hour daily-reset picker; schedule-file field gated to file kinds).
- App.test.tsx coverage: create success + 422 error surface + update success.
**Verification**
- ErsatzTV.Tests 621 green; Core.Tests 493 green (+1 skip); web 218 green; tsc + vite build clean.
- Live E2E (scratch config, real browser): all create/update/validation paths (201/422/404) + both dialogs exercised; screenshots taken. Sequential create only checks file existence (parity with Blazor) — bogus YAML fails later at build time, as upstream.
Part of #144 / #162 (slice S5 — do not auto-close).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
- CreatePlayoutRequest now carries a PlayoutScheduleKind discriminator, a
nullable ProgramScheduleId, and a ScheduleFile so POST /api/playouts can
create Classic, Block, Sequential, Scripted, or ExternalJson playouts (not
just Classic). ToCommand() validates per-kind requirements and returns
Either<BaseError, CreatePlayout>, surfacing 422 on mismatched fields via the
existing ToErrorResult() mapping.
- Add PUT /api/playouts/{id} (UpdatePlayoutDetailsRequest): DailyRebuildTime is
always applied (null clears the daily reset, matching the Blazor
SchedulePlayoutReset "Do not automatically reset" semantics); ScheduleFile is
only valid for Sequential/Scripted/ExternalJson playouts (422 otherwise) and
dispatches the matching Update*Playout command.
- Playout existence is checked via GetPlayoutById (real 404) before dispatching
UpdatePlayout, since the command's own "Playout does not exist." validation
produces a plain BaseError (422), not NotFoundError -- an existing quirk in
UpdatePlayoutHandler left as-is (out of scope for this slice).
- Extend ApiErrorResponseMetadataTests + PlayoutControllerTests for the new
Update action and the widened Create action (block/sequential/file-kind
validation paths).
- Regenerate ErsatzTV/wwwroot/openapi/v1.json via update-openapi.sh.
Regenerate v1.d.ts from the updated OpenAPI spec and add createPlayout()/
updatePlayoutDetails() to the playouts API client, with URL/body-assert tests
following the ffmpegProfiles.test.ts pattern.
- Enable the previously-disabled "Add Playout" button on the Playouts screen:
a new dialog picks kind (Classic/Block/Sequential/Scripted/ExternalJson),
channel (annotating channels that already appear in the loaded playouts list
as "already has a playout" -- the channel list DTO has no playout-count
field, so this is a best-effort annotation; a real conflict still surfaces
via the server's 422 in the dialog's error banner), a schedule picker for
Classic, and a schedule-file input with the same helper text as the Blazor
PlayoutEditor for the file-backed kinds. On success the new playout is
selected and the list refreshes.
- Add an "Edit details" affordance on the Playout detail card: a dialog to set
the daily reset time (half-hour options mirroring SchedulePlayoutReset.razor,
plus "Do not automatically reset") and, for Sequential/Scripted/ExternalJson
playouts, the schedule file.
- Add App.test.tsx coverage: classic-playout creation (asserts the POST body
and dialog close), inline 422 error surfacing, daily-rebuild-time edit
(asserts the PUT body), and schedule-file-field visibility gated by kind.
Extends mockDashboardApi with method-aware POST /api/playouts and
PUT /api/playouts/{id} handling.
A rejected scripted schedule file no longer leaves DailyRebuildTime
half-applied; the file update is the only fallible step post-pre-check.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adversarial review complete — no must-fix findings. Disposition:
Applied:
15f2beb7 — CI lint failure + review should-fix 2 in one: the AddPlayoutDialog schedules effect called setState synchronously (lint error) and had no .catch on getSchedules(). Now: loading is derived (kind === 'Classic' && schedules === null), fetch happens lazily once, rejection falls back to an empty list (submit stays blocked by canSubmit).
f06bc064 — review should-fix 1: PUT /api/playouts/{id} now applies the fallible schedule-file update beforeUpdatePlayout, so a rejected scripted file path no longer persists a half-applied dailyRebuildTime.
Noted, not changed (by design): PUT-replace semantics for dailyRebuildTime (documented in the endpoint description; SPA always sends both fields); Classic+scheduleFile extra fields silently ignored (lenient, matches documented per-kind requirements); scheduleKind: "None" correctly 422s.
Folded into existing backlog nits: new PUT route lacks Name= (same as Create/Delete); GetPlayoutById (3 Includes) reused as existence pre-check; AddPlayoutDialog fetches channels/schedules even when never opened; edit dialog's half-hour picker can't display API-set odd values like 06:15:00 (preserved on save, cosmetic).
**Adversarial review complete** — no must-fix findings. Disposition:
**Applied:**
- `15f2beb7` — CI lint failure + review should-fix 2 in one: the AddPlayoutDialog schedules effect called `setState` synchronously (lint error) and had no `.catch` on `getSchedules()`. Now: loading is *derived* (`kind === 'Classic' && schedules === null`), fetch happens lazily once, rejection falls back to an empty list (submit stays blocked by `canSubmit`).
- `f06bc064` — review should-fix 1: `PUT /api/playouts/{id}` now applies the fallible schedule-file update **before** `UpdatePlayout`, so a rejected scripted file path no longer persists a half-applied `dailyRebuildTime`.
**Noted, not changed (by design):** PUT-replace semantics for `dailyRebuildTime` (documented in the endpoint description; SPA always sends both fields); Classic+`scheduleFile` extra fields silently ignored (lenient, matches documented per-kind requirements); `scheduleKind: "None"` correctly 422s.
**Folded into existing backlog nits:** new PUT route lacks `Name=` (same as Create/Delete); `GetPlayoutById` (3 Includes) reused as existence pre-check; AddPlayoutDialog fetches channels/schedules even when never opened; edit dialog's half-hour picker can't display API-set odd values like `06:15:00` (preserved on save, cosmetic).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Slice S5 of the #162 scheduling REST plan (parity issue #144): fixes the disabled Add Playout button.
API
POST /api/playoutsnow creates playouts of all 5 schedule kinds via ascheduleKinddiscriminator onCreatePlayoutRequest(programScheduleIdnow nullable; newscheduleFile). Per-kind validation → 422: Classic requiresprogramScheduleId, Sequential/Scripted/ExternalJson requirescheduleFile, Block requires neither.PUT /api/playouts/{id}: updatesdailyRebuildTime(null clears — mirrors Blazor's "Do not automatically reset") andscheduleFile(Sequential/Scripted/ExternalJson only, else 422). 404 via pre-check (UpdatePlayoutHandler's own not-found is a plain BaseError → would be 422; follow-up candidate).ApiErrorResponseMetadataTests+PlayoutControllerTestsextended; OpenAPI spec regenerated.SPA
createPlayout()/updatePlayoutDetails()inweb/src/api/playouts.ts+ URL-assert tests.Verification
Part of #144 / #162 (slice S5 — do not auto-close).
🤖 Generated with Claude Code
- CreatePlayoutRequest now carries a PlayoutScheduleKind discriminator, a nullable ProgramScheduleId, and a ScheduleFile so POST /api/playouts can create Classic, Block, Sequential, Scripted, or ExternalJson playouts (not just Classic). ToCommand() validates per-kind requirements and returns Either<BaseError, CreatePlayout>, surfacing 422 on mismatched fields via the existing ToErrorResult() mapping. - Add PUT /api/playouts/{id} (UpdatePlayoutDetailsRequest): DailyRebuildTime is always applied (null clears the daily reset, matching the Blazor SchedulePlayoutReset "Do not automatically reset" semantics); ScheduleFile is only valid for Sequential/Scripted/ExternalJson playouts (422 otherwise) and dispatches the matching Update*Playout command. - Playout existence is checked via GetPlayoutById (real 404) before dispatching UpdatePlayout, since the command's own "Playout does not exist." validation produces a plain BaseError (422), not NotFoundError -- an existing quirk in UpdatePlayoutHandler left as-is (out of scope for this slice). - Extend ApiErrorResponseMetadataTests + PlayoutControllerTests for the new Update action and the widened Create action (block/sequential/file-kind validation paths). - Regenerate ErsatzTV/wwwroot/openapi/v1.json via update-openapi.sh.- Enable the previously-disabled "Add Playout" button on the Playouts screen: a new dialog picks kind (Classic/Block/Sequential/Scripted/ExternalJson), channel (annotating channels that already appear in the loaded playouts list as "already has a playout" -- the channel list DTO has no playout-count field, so this is a best-effort annotation; a real conflict still surfaces via the server's 422 in the dialog's error banner), a schedule picker for Classic, and a schedule-file input with the same helper text as the Blazor PlayoutEditor for the file-backed kinds. On success the new playout is selected and the list refreshes. - Add an "Edit details" affordance on the Playout detail card: a dialog to set the daily reset time (half-hour options mirroring SchedulePlayoutReset.razor, plus "Do not automatically reset") and, for Sequential/Scripted/ExternalJson playouts, the schedule file. - Add App.test.tsx coverage: classic-playout creation (asserts the POST body and dialog close), inline 422 error surfacing, daily-rebuild-time edit (asserts the PUT body), and schedule-file-field visibility gated by kind. Extends mockDashboardApi with method-aware POST /api/playouts and PUT /api/playouts/{id} handling.Adversarial review complete — no must-fix findings. Disposition:
Applied:
15f2beb7— CI lint failure + review should-fix 2 in one: the AddPlayoutDialog schedules effect calledsetStatesynchronously (lint error) and had no.catchongetSchedules(). Now: loading is derived (kind === 'Classic' && schedules === null), fetch happens lazily once, rejection falls back to an empty list (submit stays blocked bycanSubmit).f06bc064— review should-fix 1:PUT /api/playouts/{id}now applies the fallible schedule-file update beforeUpdatePlayout, so a rejected scripted file path no longer persists a half-applieddailyRebuildTime.Noted, not changed (by design): PUT-replace semantics for
dailyRebuildTime(documented in the endpoint description; SPA always sends both fields); Classic+scheduleFileextra fields silently ignored (lenient, matches documented per-kind requirements);scheduleKind: "None"correctly 422s.Folded into existing backlog nits: new PUT route lacks
Name=(same as Create/Delete);GetPlayoutById(3 Includes) reused as existence pre-check; AddPlayoutDialog fetches channels/schedules even when never opened; edit dialog's half-hour picker can't display API-set odd values like06:15:00(preserved on save, cosmetic).