Add optional `int? Id` to ScheduleItemRequest/ReplaceProgramScheduleItem so a client can round-trip each existing item's server id. When ids are present, ReplaceProgramScheduleItemsHandler reconciles by id (not array position), so an item's persisted fill-group/shuffle state (PlayoutScheduleItemFillGroupIndex, FK OnDelete Cascade) follows the logical item across reorders/inserts instead of being inherited by whatever previously occupied its new slot (#259, split from #252/#253). A fully id-less payload keeps the verbatim positional fallback. Guards (inside PersistItems, after CheckVersion so 412 precedes 422): duplicate id -> 422; id not in this schedule -> 422 (a stale id under Phase-1 force-write is a live lost-update signal, not a new item). Index stays array-position derived. Regenerated v1.json + TS client. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
using ErsatzTV.Core;
|
|
using ErsatzTV.Core.Domain;
|
|
using ErsatzTV.Core.Scheduling;
|
|
|
|
namespace ErsatzTV.Application.ProgramSchedules;
|
|
|
|
public record ReplaceProgramScheduleItem(
|
|
int? Id,
|
|
int Index,
|
|
StartType StartType,
|
|
TimeSpan? StartTime,
|
|
FixedStartTimeBehavior? FixedStartTimeBehavior,
|
|
PlayoutMode PlayoutMode,
|
|
CollectionType CollectionType,
|
|
int? CollectionId,
|
|
int? MultiCollectionId,
|
|
int? SmartCollectionId,
|
|
int? RerunCollectionId,
|
|
int? MediaItemId,
|
|
int? PlaylistId,
|
|
string SearchTitle,
|
|
string SearchQuery,
|
|
PlaybackOrder PlaybackOrder,
|
|
MarathonGroupBy MarathonGroupBy,
|
|
bool MarathonShuffleGroups,
|
|
bool MarathonShuffleItems,
|
|
int? MarathonBatchSize,
|
|
FillWithGroupMode FillWithGroupMode,
|
|
MultipleMode MultipleMode,
|
|
string MultipleCount,
|
|
TimeSpan? PlayoutDuration,
|
|
TailMode TailMode,
|
|
int? DiscardToFillAttempts,
|
|
string CustomTitle,
|
|
GuideMode GuideMode,
|
|
int? PreRollFillerId,
|
|
int? MidRollFillerId,
|
|
int? PostRollFillerId,
|
|
int? TailFillerId,
|
|
int? FallbackFillerId,
|
|
List<int> WatermarkIds,
|
|
List<int> GraphicsElementIds,
|
|
string PreferredAudioLanguageCode,
|
|
string PreferredAudioTitle,
|
|
string PreferredSubtitleLanguageCode,
|
|
ChannelSubtitleMode? SubtitleMode) : IProgramScheduleItemRequest;
|
|
|
|
public record ReplaceProgramScheduleItems(
|
|
int ProgramScheduleId,
|
|
List<ReplaceProgramScheduleItem> Items,
|
|
Option<int> ExpectedVersion = default) : IRequest<
|
|
Either<BaseError, IEnumerable<ProgramScheduleItemViewModel>>>;
|