using AdminBLL.BIZTransactionType; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace AdminSL.EndPoints.BIZTransactionType { public class GetBizTransactionType : BaseEndpoint> { private readonly IBIZTransactionTypeBLL _BIZTransactionTypeBLL; public GetBizTransactionType(IBIZTransactionTypeBLL IBIZTransactionTypeBLL) => _BIZTransactionTypeBLL = IBIZTransactionTypeBLL; public override void Configure() { Get("/BIZTransactionType/GetBizTransactionType"); AllowAnonymous(); } public record Parameters( [property: FromHeader] string Login, [property: QueryParam] int BIZTransactionTypeId ); protected override string? GetCacheKey(Parameters req, LoginDTO login) => null; protected override async Task> ExecuteAsync( Parameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var data = await _BIZTransactionTypeBLL.GetBIZTransactionType(req.BIZTransactionTypeId, LoginDTO); return await GB5Shared.ResponseStandard.Response .CreateSuccessResponse(data, CacheKeyLevel.NOT_REQUIRED, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response .CreateExceptionError(ex, CacheKeyLevel.NOT_REQUIRED, LoginDTO, ex.Message, 500); } } } }