using FastEndpoints; using FrameworkBLL.Operation; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static FrameworkDAL.Constant.Constant; namespace FrameworkSL.Endpoints.Operation { public class DeleteOperation : BaseEndpoint> { public readonly IOperationBLL _OperationBLL; public DeleteOperation(IOperationBLL IOperationBLL) { _OperationBLL = IOperationBLL; } public override void Configure() { Delete("/Operation/DeleteOperation"); AllowAnonymous(); } public record DeleteOperationParameters( [property: FromHeader] string Login, [property: QueryParam] int OperationId ); protected override async Task> ExecuteAsync(DeleteOperationParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _OperationBLL.DeleteOperation(req.OperationId, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.UserLevel, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.UserLevel, LoginDTO, ex.Message, 500); } } } }