using ComplianceBLL.GSTOutward; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace ComplianceSL.Endpoints.GSTOutward; public class GetGSTOutward : BaseEndpoint> { private readonly IGSTOutwardBLL _bll; public GetGSTOutward(IGSTOutwardBLL bll) => _bll = bll; public override void Configure() { Get("/GSTOutward/GetGSTOutward"); AllowAnonymous(); } public record GetGSTOutwardParameters( [property: FromHeader] string Login, [property: QueryParam] int OutwardId ); protected override string? GetCacheKey(GetGSTOutwardParameters req, LoginDTO login) => $"GSTOUTWARD:{login.ClientId}:{req.OutwardId}"; protected override async Task> ExecuteAsync(GetGSTOutwardParameters req, LoginDTO login, CancellationToken ct) { try { var result = await _bll.GetGSTOutwardAsync(req.OutwardId, login, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.CLIENT_LEVEL, login); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.CLIENT_LEVEL, login, ex.Message, 500); } } }