Adds MultiCollectionController + RerunCollectionController (list/get/create/update/ delete) over the existing MediatR handlers, with response/request DTOs, controller + contract tests, regenerated OpenAPI + TS types, and thin SPA api-client modules. SPA editor screens are a follow-up. Rerun request DTO resolves the chosen entity id into the minimal VM the handler reads (documented inline). Refs #151, #152 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
27 lines
786 B
C#
27 lines
786 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using ErsatzTV.Application.MediaCollections;
|
|
using ErsatzTV.Core.Domain;
|
|
|
|
namespace ErsatzTV.Controllers.Api.Requests;
|
|
|
|
public record MultiCollectionItemRequest(
|
|
int? CollectionId,
|
|
int? SmartCollectionId,
|
|
bool ScheduleAsGroup,
|
|
PlaybackOrder PlaybackOrder);
|
|
|
|
public record CreateMultiCollectionRequest(string Name, List<MultiCollectionItemRequest> Items)
|
|
{
|
|
public CreateMultiCollection ToCommand() =>
|
|
new(
|
|
Name,
|
|
(Items ?? new List<MultiCollectionItemRequest>())
|
|
.Select(i => new CreateMultiCollectionItem(
|
|
i.CollectionId,
|
|
i.SmartCollectionId,
|
|
i.ScheduleAsGroup,
|
|
i.PlaybackOrder))
|
|
.ToList());
|
|
}
|