Backend: 401 documented on all mutating settings/resolution routes; resolution delete distinguishes 404 (unknown) from 422 (not custom); XMLTV enum bridging via exhaustive switch instead of int casts; field-level Arg.Is assertions incl. non-null watermark/filler flow. Frontend: resolution add/delete failures surfaced inline (were silent); partial saves merge succeeded groups via allSettled; empty numeric fields invalid + tunerCount min 1; HLS Direct select shows out-of-list wire values; media-source rows show derived last-scan. ErsatzTV.Tests 495; web suite 145. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
34 lines
1.4 KiB
C#
34 lines
1.4 KiB
C#
using ErsatzTV.Application.Configuration;
|
|
using ApiXmltvBlockBehavior = ErsatzTV.Core.Api.Settings.XmltvBlockBehavior;
|
|
using ApiXmltvTimeZone = ErsatzTV.Core.Api.Settings.XmltvTimeZone;
|
|
|
|
namespace ErsatzTV.Controllers.Api.Requests;
|
|
|
|
public record UpdateXmltvSettingsRequest(int DaysToBuild, ApiXmltvTimeZone TimeZone, ApiXmltvBlockBehavior BlockBehavior)
|
|
{
|
|
public UpdateXmltvSettings ToCommand() =>
|
|
new(
|
|
new XmltvSettingsViewModel
|
|
{
|
|
DaysToBuild = DaysToBuild,
|
|
TimeZone = ToVmTimeZone(TimeZone),
|
|
BlockBehavior = ToVmBlockBehavior(BlockBehavior)
|
|
});
|
|
|
|
private static XmltvTimeZone ToVmTimeZone(ApiXmltvTimeZone timeZone) =>
|
|
timeZone switch
|
|
{
|
|
ApiXmltvTimeZone.Local => XmltvTimeZone.Local,
|
|
ApiXmltvTimeZone.Utc => XmltvTimeZone.Utc,
|
|
_ => throw new ArgumentOutOfRangeException(nameof(timeZone), timeZone, null)
|
|
};
|
|
|
|
private static XmltvBlockBehavior ToVmBlockBehavior(ApiXmltvBlockBehavior blockBehavior) =>
|
|
blockBehavior switch
|
|
{
|
|
ApiXmltvBlockBehavior.SplitTimeEvenly => XmltvBlockBehavior.SplitTimeEvenly,
|
|
ApiXmltvBlockBehavior.UseActualTimes => XmltvBlockBehavior.UseActualTimes,
|
|
_ => throw new ArgumentOutOfRangeException(nameof(blockBehavior), blockBehavior, null)
|
|
};
|
|
}
|