feat(api, dal): в настройки в БД добавлено поле EsppRobotAccountTimeZoneHour со значением 3, обновлено ScheduleTimezone на MSK. В api в задании роботу по расписаниям, время выдается с учетом таймзоны робота.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user