Files
ersatztv/ErsatzTV/Controllers/Api/Requests/ReplacePlayoutAlternateSchedulesRequest.cs
T
timothyandClaude Fable 5 50b13afac3 feat(api): REST endpoints for playout alternate schedules and templates (#144 S6 (#162))
Adds per-playout REST for classic-playout alternate schedules and
block-playout templates, plus the default-deco read-side deferred from S3:

- GET/PUT /api/playouts/{id}/alternate-schedules (Classic only; 422 otherwise)
- GET/PUT /api/playouts/{id}/templates (Block only; 422 otherwise)
- PlayoutResponseModel gains decoId/decoName (GetPlayoutById includes Deco)

PUT assigns Index from array order (top = highest priority, last = catch-all
default), mirroring the Blazor editors. Alternate-schedule PUT requires a
non-empty list and existing ProgramScheduleIds; template PUT requires existing
TemplateIds and any supplied DecoTemplateId. Regenerates the OpenAPI spec.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 20:29:29 +02:00

18 lines
799 B
C#

using ErsatzTV.Application.Playouts;
namespace ErsatzTV.Controllers.Api.Requests;
public record ReplacePlayoutAlternateSchedulesRequest(List<PlayoutAlternateScheduleItemRequest> Items)
{
// Index is assigned from array order: the first item is the highest priority and the last item
// is the lowest priority (the catch-all default whose schedule becomes the playout's default
// schedule). This mirrors the Blazor editor, which lists items top-to-bottom in priority order
// and writes the highest-Index item's schedule as the playout default.
public ReplacePlayoutAlternateScheduleItems ToCommand(int playoutId) =>
new(
playoutId,
(Items ?? [])
.Select((item, index) => item.ToReplaceItem(index))
.ToList());
}