using FastEndpoints; using AccountsBLL.AccountBalance; 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.AccountBalance { public class GetAccountBalanceDetail : BaseEndpoint> { private readonly IAccountBalanceBLL _accountBalanceBLL; public GetAccountBalanceDetail(IAccountBalanceBLL accountBalanceBLL) { _accountBalanceBLL = accountBalanceBLL; } public override void Configure() { Post("/AccountBalance/GetAccountBalanceDetail"); AllowAnonymous(); } public record GetAccountBalanceDetailParameters( [property: FromHeader] string Login, [property: FromBody] CriteriaDTO CriteriaDTO, [property: QueryParam] int OUId ); protected override async Task> ExecuteAsync( GetAccountBalanceDetailParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _accountBalanceBLL.GetAccountBalanceDetail( req.OUId, 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 ); } } } }