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