using ComplianceBLL.GSTInward; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace ComplianceSL.Endpoints.GSTInward; public class GetReconSummary : BaseEndpoint> { private readonly IGSTInwardBLL _bll; public GetReconSummary(IGSTInwardBLL bll) => _bll = bll; public override void Configure() { Get("/GSTInward/GetReconSummary"); AllowAnonymous(); } public record GetReconSummaryParameters( [property: FromHeader] string Login, [property: QueryParam] string OurGSTIN, [property: QueryParam] string Period, [property: QueryParam] string ReconType = "InwardVs2B" ); protected override string? GetCacheKey(GetReconSummaryParameters req, LoginDTO login) => $"GSTRECON:SUMMARY:{login.ClientId}:{req.OurGSTIN}:{req.Period}:{req.ReconType}"; protected override async Task> ExecuteAsync(GetReconSummaryParameters req, LoginDTO login, CancellationToken ct) { try { var result = await _bll.GetReconSummaryAsync(req.OurGSTIN, req.Period, req.ReconType, 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); } } }