using AdminBLL.BIZTransaction; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace AdminSL.EndPoints.BIZTransaction { public class GetBIZTransaction : BaseEndpoint> { private readonly IBIZTransactionBLL _BIZTransactionBLL; public GetBIZTransaction(IBIZTransactionBLL IBIZTransactionBLL) { _BIZTransactionBLL = IBIZTransactionBLL; } public override void Configure() { Get("/BIZTransaction/GetBIZTransaction"); AllowAnonymous(); } public record GetBIZTransactionParameters( [property: FromHeader] string Login, [property: QueryParam] int BIZTransactionId ); protected override string? GetCacheKey(GetBIZTransactionParameters parameter, LoginDTO LoginDTO) { try { return KeyGenerator.KeyGeneration(parameter.BIZTransactionId!, EntityConstant.OBJECTBIZTRANSACTION, CacheKeyLevel.USER_LEVEL, LoginDTO); } catch (Exception) { throw; } } protected override async Task> ExecuteAsync(GetBIZTransactionParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _BIZTransactionBLL.GetBIZTransaction(req.BIZTransactionId, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.USER_LEVEL, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.USER_LEVEL, LoginDTO, ex.Message, 500); } } } }