using FastEndpoints; using FrameworkBLL.ZIP; using FrameworkSL.Endpoints.ZIP; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.ZIP { public class DeleteZIP : BaseEndpoint> { private readonly IZIPBLL _ZIPBLL; public DeleteZIP(IZIPBLL ZIPBLL) { _ZIPBLL = ZIPBLL; } public override void Configure() { Delete("/ZIP/DeleteZIP"); AllowAnonymous(); } public record DeleteZIPParameters( [property: FromHeader] string Login, [property: QueryParam] int ZIPId ); protected override async Task> ExecuteAsync(DeleteZIPParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _ZIPBLL.DeleteZIP(req.ZIPId, 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); } } } }