using FastEndpoints; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using PayRollBLL.Leave; using PayRollBLL.TLeave; using static GB5Shared.GB5Constant.Constant; namespace PayRollSL.EndPoints.TLeave { public class GetSelectListTLeave : BaseEndpoint> { private readonly ITLeaveBLL _TLeaveBLL; public GetSelectListTLeave(ITLeaveBLL ITLeaveBLL) { _TLeaveBLL = ITLeaveBLL; } public override void Configure() { Post("/Leave/GetSelectListTLeave"); AllowAnonymous(); } public record GetSelectListTLeaveParameters( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO, [property: QueryParam] int FirstNumber, [property: QueryParam] int MaxResult ); protected override async Task> ExecuteAsync(GetSelectListTLeaveParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _TLeaveBLL.GetSelectListTLeave(req.FirstNumber, req.MaxResult, req.CriteriaDTO, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.NOT_REQUIRED, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.NOT_REQUIRED, LoginDTO, ex.Message, 500); } } } }