Adds DecoTemplateController mirroring TemplateController: CRUD for deco template groups, deco templates (flat list + by-id), item listing, and a full-replace PUT for a deco template's item list. Hardening (deviation from a literal port of the existing handlers, matching the #144 S2 fix for ReplaceTemplateItemsHandler): - CreateDecoTemplateHandler now validates DecoTemplateGroupId exists before insert (previously a bad id hit the FK constraint at SaveChanges and surfaced as a 500; now a 422). - ReplaceDecoTemplateItemsHandler now rejects invalid items (unknown DecoId, StartTime >= EndTime unless EndTime is the end-of-day sentinel 00:00:00, or overlapping ranges) with a 422 instead of silently dropping/persisting them - the same silent-drop/silent-overlap bug class already fixed for templates. Response DTOs serialize the raw item TimeSpans (via .TimeOfDay), so an end-of-day item still round-trips as StartTime=22:00:00/EndTime=00:00:00 regardless of the ViewModel's day-wrapping DateTime representation.
10 lines
236 B
C#
10 lines
236 B
C#
#nullable enable
|
|
namespace ErsatzTV.Core.Api.Scheduling;
|
|
|
|
public record DecoTemplateWithItemsResponseModel(
|
|
int Id,
|
|
int DecoTemplateGroupId,
|
|
string GroupName,
|
|
string Name,
|
|
List<DecoTemplateItemResponseModel> Items);
|