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