Files
ersatztv/ErsatzTV/Controllers/Api/Requests/AutoTuneRequests.cs
T
timothy f31476e012 fix(69): auto-tune review fixes — null channels, orphaned SmartCollection, oversized preview names, doc drift
- CreateAutoTunedChannelsRequest.ToCommand(): guard null Channels (was NREing on
  a request body that omits "channels", causing HTTP 500).
- CreateAutoTunedChannelsHandler.CreateOne: when CreateChannelFromLineup returns
  Left (Skipped/Failed), roll back the just-created SmartCollection via
  DeleteSmartCollection so retries don't fail on SmartCollection-name uniqueness.
  Best-effort; the delete result does not change the outcome.
- PreviewAutoTuneChannelsHandler: filter out proposals whose generated name
  exceeds the 50-char Channel.Name limit before number allocation, so numbers
  aren't wasted on proposals that can never be created.
- docs/superpowers/specs/2026-07-16-auto-tuning-design.md: fix field-name drift
  in JSON examples (proposedNumber -> number, error -> reason) to match the
  actual AutoTuneProposal/AutoTuneChannelOutcome DTOs.

Refs #69
2026-07-16 22:18:52 +02:00

31 lines
793 B
C#

using ErsatzTV.Application.Channels;
using ErsatzTV.Core.Domain;
namespace ErsatzTV.Controllers.Api.Requests;
public record PreviewAutoTuneChannelsRequest(
List<AutoTuneAxis> Axes,
int MinItems,
int StartingNumber)
{
public PreviewAutoTuneChannels ToCommand() => new(Axes, MinItems, StartingNumber);
}
public record CreateAutoTunedChannelsRequest(
int TemplateId,
string Group,
List<AutoTunedChannelRequest> Channels)
{
public CreateAutoTunedChannels ToCommand() =>
new(TemplateId, Group, (Channels ?? []).Select(c => c.ToCommand()).ToList());
}
public record AutoTunedChannelRequest(
AutoTuneAxis Axis,
string Value,
string Name,
string Number)
{
public AutoTuneChannelSelection ToCommand() => new(Axis, Value, Name, Number);
}