GET /api/blocks, GET/POST/DELETE /api/blocks[/{id}]
GET /api/blocks/{id}/items (404-guarded, index-ordered)
PUT /api/blocks/{id} — full replace (name/minutes/stopScheduling/items), index auto-assigned from array order (ReplaceScheduleItemsRequest precedent)
POST /api/blocks/{id}/preview — non-persisting playout preview (verified: no SaveChanges)
Search pickers for the item editor: GET /api/search/{collections,television-shows,television-seasons,smart-collections}?query= (thin wrappers, capped in handlers; global GET /api/search untouched)
New response DTOs in ErsatzTV.Core/Api/Scheduling/ (#nullable enable); enums emit as string enums
Root-cause fix from live E2E: CreateBlockHandler now validates block-group existence (was: FK violation → unhandled 500; now: 422)
SPA
web/src/api/blocks.ts + tests; /app/blocks grouped list (group/block create/delete) and /app/blocks/{id} editor: name, hours + 5-min-increment minutes, stop-scheduling, item table (add/remove/move/duplicate), 5-kind collection picker with debounced typeahead, conditional playback-order, watermark/graphics multi-selects, preview dialog. Nav entry next to Schedules.
Review fixes applied: legacy Artist/MultiCollection items round-trip intact (render read-only, ids preserved on save); AsyncPicker keyed by row+type to kill stale-options cross-writes.
Verification
ErsatzTV.Tests 654 green (BlockControllerTests: command mapping, 422-without-dispatch, index assignment); Core.Tests 493 green; web 234 green; lint/tsc/build clean.
Live E2E: full API matrix (201/204/404/422, dup names, minutes divisibility, cascade delete, preview non-persistence) + browser flows (create group/block, editor save+reload round-trip, preview dialog, deletes). Found+fixed the 500 above.
origin/main (post-#170) merged in; v1.json/v1.d.ts regenerated with zero drift.
Deferred: REST CopyBlock (CQRS exists, Blazor has copy — follow-up with S2's CopyTemplate if wanted). Part of #144 / #162 (slice S1 — do not auto-close).
Adds BlockController (block groups + blocks CRUD, items GET, full replace,
non-persisting preview) mirroring ScheduleController, plus four scheduling
search picker endpoints on SearchController (collections, television shows,
television seasons, smart collections). Response DTOs in ErsatzTV.Core/Api/
Scheduling; request DTOs with ToCommand index auto-assignment.
#144 S1 (#162)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
POST /api/blocks with a nonexistent blockGroupId returned an
unhandled DbUpdateException (HTTP 500) because CreateBlockHandler
never checked the referenced block group before inserting, letting
the SQLite FK constraint raise. Add a BaseError validation (422),
matching the "does not exist" precedent already used elsewhere.
Found via live E2E testing.
BlocksScreen couldn't load/save blocks containing Artist or
MultiCollection items (creatable upstream; ReplaceBlockItemsHandler
already supports both) - itemFromResponse dropped multiCollectionId
and left selectionName empty for those kinds, and toRequestItem
hardcoded multiCollectionId to null, so re-saving such a block
produced a 422 and made it uneditable. Carry the ids/names through
DraftItem and render them read-only (parity with Blazor, which
doesn't offer these kinds in the creation picker either).
Also key the item AsyncPicker by selection identity + collection
type so switching rows or collection type remounts it with clean
state, instead of carrying over a stale query/options list that
could store a wrong-kind id.
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 S1 of the #162 scheduling REST plan (parity issue #144): Blocks + Block Groups.
API (new
BlockController, mirrors ScheduleController patterns)GET/POST /api/blocks/groups,DELETE /api/blocks/groups/{id}(cascade documented)GET /api/blocks,GET/POST/DELETE /api/blocks[/{id}]GET /api/blocks/{id}/items(404-guarded, index-ordered)PUT /api/blocks/{id}— full replace (name/minutes/stopScheduling/items), index auto-assigned from array order (ReplaceScheduleItemsRequest precedent)POST /api/blocks/{id}/preview— non-persisting playout preview (verified: no SaveChanges)GET /api/search/{collections,television-shows,television-seasons,smart-collections}?query=(thin wrappers, capped in handlers; globalGET /api/searchuntouched)ErsatzTV.Core/Api/Scheduling/(#nullable enable); enums emit as string enumsCreateBlockHandlernow validates block-group existence (was: FK violation → unhandled 500; now: 422)SPA
web/src/api/blocks.ts+ tests;/app/blocksgrouped list (group/block create/delete) and/app/blocks/{id}editor: name, hours + 5-min-increment minutes, stop-scheduling, item table (add/remove/move/duplicate), 5-kind collection picker with debounced typeahead, conditional playback-order, watermark/graphics multi-selects, preview dialog. Nav entry next to Schedules.Verification
Deferred: REST
CopyBlock(CQRS exists, Blazor has copy — follow-up with S2's CopyTemplate if wanted). Part of #144 / #162 (slice S1 — do not auto-close).🤖 Generated with Claude Code
Adds a ChicoryTV Blocks screen under /app/blocks: grouped block list with group/block create + delete, and a /app/blocks/{id} editor (name, duration hours + 5-min increments, stop-scheduling, item table with add/remove/move/ duplicate, per-item collection-type pickers via debounced search endpoints, conditional playback-order, EPG/watermark toggles, watermark & graphics multi-selects, and a non-persisting playout preview dialog). Adds web/src/api/blocks.ts client + regenerated v1.d.ts types. #144 S1 (#162) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>