feat(dal): WeekendDayService - метод проверки на рабочий день

This commit is contained in:
Mikhail Trubnikov
2024-09-16 17:01:04 +10:00
parent 4a47e194f8
commit 251e3a20b0
8 changed files with 103 additions and 3 deletions

View File

@@ -53,6 +53,8 @@
public const string CreateCache = Base + "/tests/cache/";
public const string IsWorkDay = Base + "/tests/is-work-day/";
public const string paramDate = "{lastRunDate}";
public const string paramApplicationInWorkId = "{applicationInWorkId}";
}

View File

@@ -5,6 +5,7 @@ using PARR.API.Contracts.V1.Responses.Base;
using PARR.API.Controllers.V1.Base;
using PARR.API.Services.Interfaces;
using PARR.DAL.CacheServices;
using PARR.DAL.Services.Interfaces;
using PARR.DAL.TransformServices;
namespace PARR.API.Controllers.V1
@@ -15,12 +16,19 @@ namespace PARR.API.Controllers.V1
private readonly IClientService clientService;
private readonly IEsppScheduleTransformService esppScheduleTransformService;
private readonly IRedisCacheService redisCacheService;
private readonly IWeekendDayService weekendDayService;
public TestController(IClientService clientService, IEsppScheduleTransformService esppScheduleTransformService, IRedisCacheService redisCacheService)
public TestController(
IClientService clientService,
IEsppScheduleTransformService esppScheduleTransformService,
IRedisCacheService redisCacheService,
IWeekendDayService weekendDayService
)
{
this.clientService = clientService;
this.esppScheduleTransformService = esppScheduleTransformService;
this.redisCacheService = redisCacheService;
this.weekendDayService = weekendDayService;
}
@@ -83,6 +91,18 @@ namespace PARR.API.Controllers.V1
}
/// <summary>
/// Проверка, это рабочий день?
/// </summary>
/// <param name="date"></param>
/// <returns></returns>
[HttpGet(ApiRoutes.Test.IsWorkDay)]
public async Task<IActionResult> IsWorkDay([FromQuery] DateOnly date)
{
return Ok(await weekendDayService.IsWorkDayAsync(date, true));
}
}
public class CaheRequestTest

View File

@@ -10,6 +10,7 @@
/// </summary>
public TimeSpan UserCacheTtl { get; set; }
/// <summary>
/// Сколько хранить в кэше заблокированных пользователей (как долго блокировать пользователя)
/// </summary>