using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using MMBLL.Terms; using MMSL.EndPoints.Terms; using static GB5Shared.GB5Constant.Constant; namespace MMSL.EndPoints.Terms { public class DeleteTerms : BaseEndpoint> { private readonly ITermsBLL _TermsBLL; public DeleteTerms(ITermsBLL TermsBLL) { _TermsBLL = TermsBLL; } public override void Configure() { Delete("/Terms/DeleteTerms"); AllowAnonymous(); } public record DeleteTermsParameters( [property: FromHeader] string Login, [property: QueryParam] int TermsId ); protected override async Task> ExecuteAsync(DeleteTermsParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var result = await _TermsBLL.DeleteTerms(req.TermsId, 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); } } } }