feat(api): add playout REST endpoints #51

Merged
timothy merged 1 commits from issue37-rest-api-playouts into main 2026-06-29 20:37:27 +02:00
Owner

Summary

Implements #37 / REST API #2d for playout create/delete.

  • Added GET /api/playouts/{id}, POST /api/playouts, and DELETE /api/playouts/{id}.
  • POST /api/playouts uses a stable request DTO with channelId and programScheduleId, delegates to CreateClassicPlayout, returns 201 Created, Location: /api/playouts/{id}, and a stable PlayoutResponseModel body.
  • DELETE /api/playouts/{id} delegates to DeletePlayout and returns 204 No Content.
  • Missing channel/schedule/playout now maps to NotFoundError so REST helpers return 404 ProblemDetails; business validation remains 422 ProblemDetails.
  • Controller is protected with the existing API-key write filter convention.
  • Regenerated static OpenAPI v1.json so 404/422 response bodies match ProblemDetails.

Tests

  • LSP diagnostics: clean for changed C# files.
  • scripts/update-openapi.sh
  • dotnet build ErsatzTV.sln
  • TZ=UTC dotnet test ErsatzTV.sln -v normal -> 223 passed, 0 failed.

Review

Adversarial review found one real test gap: the missing-schedule handler test was hitting the missing-channel branch. Fixed by seeding a valid channel before asserting the missing schedule path.

No DB model changes; no migrations required.

fixes #37

## Summary Implements #37 / REST API #2d for playout create/delete. - Added `GET /api/playouts/{id}`, `POST /api/playouts`, and `DELETE /api/playouts/{id}`. - `POST /api/playouts` uses a stable request DTO with `channelId` and `programScheduleId`, delegates to `CreateClassicPlayout`, returns `201 Created`, `Location: /api/playouts/{id}`, and a stable `PlayoutResponseModel` body. - `DELETE /api/playouts/{id}` delegates to `DeletePlayout` and returns `204 No Content`. - Missing channel/schedule/playout now maps to `NotFoundError` so REST helpers return `404 ProblemDetails`; business validation remains `422 ProblemDetails`. - Controller is protected with the existing API-key write filter convention. - Regenerated static OpenAPI `v1.json` so 404/422 response bodies match `ProblemDetails`. ## Tests - LSP diagnostics: clean for changed C# files. - `scripts/update-openapi.sh` - `dotnet build ErsatzTV.sln` - `TZ=UTC dotnet test ErsatzTV.sln -v normal` -> 223 passed, 0 failed. ## Review Adversarial review found one real test gap: the missing-schedule handler test was hitting the missing-channel branch. Fixed by seeding a valid channel before asserting the missing schedule path. No DB model changes; no migrations required. fixes #37
timothy added 1 commit 2026-06-29 20:31:56 +02:00
feat(api): add playout REST endpoints
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 3m34s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 4m48s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
b53b06c615
fixes #37
timothy merged commit 30ecd9a8a7 into main 2026-06-29 20:37:27 +02:00
timothy deleted branch issue37-rest-api-playouts 2026-06-29 20:37:27 +02:00
Sign in to join this conversation.