using AccountsBLL.WarehouseFact; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace AccountsSL.EndPoints.WarehouseFact { public class DeleteWarehouseFact : BaseEndpoint> { private readonly IWarehouseFactBLL _WarehouseFactBLL; public DeleteWarehouseFact(IWarehouseFactBLL WarehouseFactBLL) { _WarehouseFactBLL = WarehouseFactBLL; } public override void Configure() { Delete("/WarehouseFact/DeleteWarehouseFact"); AllowAnonymous(); } public record DeleteWarehouseFactParameters( [property: FromHeader] string Login, [property: QueryParam] int FactId ); protected override async Task> ExecuteAsync(DeleteWarehouseFactParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _WarehouseFactBLL.DeleteWarehouseFact(req.FactId, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.NOT_REQUIRED, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.NOT_REQUIRED, LoginDTO, ex.Message, 500); } } } }