using ComplianceBLL.GSTOutward; using ComplianceDAL.DTO.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 GetGSTOutwardList : BaseEndpoint> { private readonly IGSTOutwardBLL _bll; public GetGSTOutwardList(IGSTOutwardBLL bll) => _bll = bll; public override void Configure() { Get("/GSTOutward/GetGSTOutwardList"); AllowAnonymous(); } public record GetGSTOutwardListParameters( [property: FromHeader] string Login, [property: QueryParam] string GSTIN, [property: QueryParam] string ReturnPeriod, [property: QueryParam] string InvoiceType = "", [property: QueryParam] int FilingStatus = -1, [property: QueryParam] int Page = 1, [property: QueryParam] int PageSize = 50 ); protected override string? GetCacheKey(GetGSTOutwardListParameters req, LoginDTO login) => $"GSTOUTWARD:LIST:{login.ClientId}:{req.GSTIN}:{req.ReturnPeriod}:{req.InvoiceType}:{req.FilingStatus}:{req.Page}"; protected override async Task> ExecuteAsync(GetGSTOutwardListParameters req, LoginDTO login, CancellationToken ct) { try { var filter = new GSTOutwardFilterDTO { GSTIN = req.GSTIN, ReturnPeriod = req.ReturnPeriod, InvoiceType = req.InvoiceType, FilingStatus = req.FilingStatus, Page = req.Page, PageSize = req.PageSize }; var result = await _bll.GetGSTOutwardListAsync(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); } } }