using ComplianceBLL.GSTInward; using ComplianceDAL.DTO.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 GetGSTInwardReconciliation : BaseEndpoint> { private readonly IGSTInwardBLL _bll; public GetGSTInwardReconciliation(IGSTInwardBLL bll) => _bll = bll; public override void Configure() { Get("/GSTInward/GetGSTInwardReconciliation"); AllowAnonymous(); } public record GetReconParameters( [property: FromHeader] string Login, [property: QueryParam] string OurGSTIN, [property: QueryParam] string Period, [property: QueryParam] string ReconType = "InwardVs2B", [property: QueryParam] string Status = "", [property: QueryParam] int Page = 1, [property: QueryParam] int PageSize = 50 ); protected override string? GetCacheKey(GetReconParameters req, LoginDTO login) => $"GSTRECON:LIST:{login.ClientId}:{req.OurGSTIN}:{req.Period}:{req.ReconType}:{req.Status}:{req.Page}"; protected override async Task> ExecuteAsync(GetReconParameters req, LoginDTO login, CancellationToken ct) { try { var filter = new GSTReconFilterDTO { OurGSTIN = req.OurGSTIN, Period = req.Period, ReconType = req.ReconType, Status = req.Status, Page = req.Page, PageSize = req.PageSize }; var result = await _bll.GetGSTInwardReconciliationAsync(filter, 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); } } }