using FastEndpoints; using AccountsBLL.Party; using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace AccountsSL.EndPoints.Party { public class GetSelectListParty : BaseEndpoint> { private readonly IPartyBLL _partyBLL; public GetSelectListParty(IPartyBLL partyBLL) { _partyBLL = partyBLL; } public override void Configure() { Post("/Party/GetSelectListParty"); AllowAnonymous(); } public record GetSelectListPartyParameters( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO, [property: QueryParam] int FirstNumber, [property: QueryParam] int MaxResult ); protected override async Task> ExecuteAsync( GetSelectListPartyParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _partyBLL.GetSelectListParty( 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 ); } } } }