using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using MMBLL.MasterSchedule; using MMDAL.DTO.MasterSchedule; using static GB5Shared.GB5Constant.Constant; namespace MMSL.EndPoints.MRPRun { public class ClearOldSchedule : BaseEndpoint> { private readonly IMasterScheduleBLL _MasterScheduleBLL; public ClearOldSchedule(IMasterScheduleBLL masterScheduleBLL) => _MasterScheduleBLL = masterScheduleBLL; public override void Configure() { Post("/MRPRun/ClearOldSchedule"); AllowAnonymous(); } public record Params( [property: FromHeader] string Login, [property: FromBody] ClearScheduleDTO ClearScheduleDTO ); protected override string? GetCacheKey(Params req, LoginDTO login) => null; protected override async Task> ExecuteAsync( Params req, LoginDTO loginDTO, CancellationToken ct) { var result = await _MasterScheduleBLL.ClearOldSchedule(req.ClearScheduleDTO, loginDTO); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.NOT_REQUIRED, loginDTO); } } }