feat(api, dal): в настройки в БД добавлено поле EsppRobotAccountTimeZoneHour со значением 3, обновлено ScheduleTimezone на MSK. В api в задании роботу по расписаниям, время выдается с учетом таймзоны робота.

This commit is contained in:
Mikhail Trubnikov
2024-08-06 10:52:27 +10:00
parent 0dcda12c01
commit c857accfb9
12 changed files with 3098 additions and 18 deletions

View File

@@ -0,0 +1,28 @@
using AutoMapper;
using PARR.API.Contracts.V1.Responses;
using PARR.BLL.Helpers;
using PARR.DAL.Contracts;
using PARR.DAL.Models;
using PARR.DAL.TransformServices;
namespace PARR.API.MappingProfiles.Resolvers
{
public class RobotTaskScheduleGenerationTimeResolver : IValueResolver<RobotConfiguration, RobotTaskScheduleResponse, string>
{
private readonly SettingsFromDb settingsFromDb;
private readonly INextRunModifierService nextRunModifierService;
public RobotTaskScheduleGenerationTimeResolver(SettingsFromDb settingsFromDb, INextRunModifierService nextRunModifierService)
{
this.settingsFromDb = settingsFromDb;
this.nextRunModifierService = nextRunModifierService;
}
public string Resolve(RobotConfiguration source, RobotTaskScheduleResponse destination, string destMember, ResolutionContext context)
{
var nextRunForRobot = nextRunModifierService.GetNextRunByAccountRobotTimeZone(source.Template!.NextRun);
return EsppScheduleHelpers.GetGenerationTime(nextRunForRobot);
}
}
}