using FrameworkBLL.GBPeriod; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; using FastEndpoints; using System.Threading; using System.Threading.Tasks; namespace FrameworkSL.Endpoints.GBPeriod { public class Gb4PeriodPicklist : BaseEndpoint> { private readonly IGBPeriodBLL _gbPeriodBLL; public Gb4PeriodPicklist(IGBPeriodBLL gbPeriodBLL) { _gbPeriodBLL = gbPeriodBLL; } public override void Configure() { Post("/GBPeriod/Gb4PeriodPicklist"); AllowAnonymous(); } public record Gb4PeriodPicklistParameters( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO ); protected override async Task> ExecuteAsync(Gb4PeriodPicklistParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _gbPeriodBLL.Gb4PeriodPicklist(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 ); } } } }