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 SubmitGSTOutward : BaseEndpoint> { private readonly IGSTOutwardBLL _bll; public SubmitGSTOutward(IGSTOutwardBLL bll) => _bll = bll; public override void Configure() { Post("/GSTOutward/SubmitGSTOutward"); AllowAnonymous(); } public record SubmitGSTOutwardParameters( [property: FromHeader] string Login, [property: FromHeader] string? GSTHeader, [property: FromBody] SubmitGSTOutwardRequestDTO Request ); protected override string? GetCacheKey(SubmitGSTOutwardParameters req, LoginDTO login) => null; protected override async Task> ExecuteAsync(SubmitGSTOutwardParameters req, LoginDTO login, CancellationToken ct) { try { var header = GSTHeaderParser.Parse(req.GSTHeader); var result = await _bll.SubmitGSTOutwardAsync(req.Request, header, 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); } } }