refactor: use default pairPeriod
This commit is contained in:
parent
984791f193
commit
2e389b252c
@ -1,6 +1,4 @@
|
||||
using Mirea.Api.Dto.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Mirea.Api.Dto.Requests.Configuration;
|
||||
@ -20,10 +18,4 @@ public class ScheduleConfigurationRequest
|
||||
/// </summary>
|
||||
[Required]
|
||||
public DateOnly StartTerm { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the pair period times, keyed by pair number.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public required IDictionary<int, PairPeriodTime> PairPeriod { get; set; }
|
||||
}
|
@ -294,7 +294,16 @@ public class SetupController(
|
||||
// every 6 hours
|
||||
CronUpdateSchedule = request.CronUpdateSchedule ?? "0 */6 * * *",
|
||||
StartTerm = request.StartTerm,
|
||||
PairPeriod = request.PairPeriod.ConvertFromDto()
|
||||
PairPeriod = new Dictionary<int, ScheduleSettings.PairPeriodTime>
|
||||
{
|
||||
{1, new ScheduleSettings.PairPeriodTime(new TimeOnly(9, 0, 0), new TimeOnly(10, 30, 0))},
|
||||
{2, new ScheduleSettings.PairPeriodTime(new TimeOnly(10, 40, 0), new TimeOnly(12, 10, 0))},
|
||||
{3, new ScheduleSettings.PairPeriodTime(new TimeOnly(12, 40, 0), new TimeOnly(14, 10, 0))},
|
||||
{4, new ScheduleSettings.PairPeriodTime(new TimeOnly(14, 20, 0), new TimeOnly(15, 50, 0))},
|
||||
{5, new ScheduleSettings.PairPeriodTime(new TimeOnly(16, 20, 0), new TimeOnly(17, 50, 0))},
|
||||
{6, new ScheduleSettings.PairPeriodTime(new TimeOnly(18, 0, 0), new TimeOnly(19, 30, 0))},
|
||||
{7, new ScheduleSettings.PairPeriodTime(new TimeOnly(19, 40, 0), new TimeOnly(21, 10, 0))},
|
||||
}
|
||||
};
|
||||
|
||||
if (!CronExpression.TryParse(general.ScheduleSettings.CronUpdateSchedule, CronFormat.Standard, out _))
|
||||
|
Loading…
Reference in New Issue
Block a user