using CRMBLL.SLA; using FastEndpoints; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace CRMSL.EndPoints.SLA { public class DeleteSLA : BaseEndpoint> { private readonly ISLABLL _SLABLL; public DeleteSLA(ISLABLL SLABLL) { _SLABLL = SLABLL; } public override void Configure() { Delete("/SLA/DeleteSLA"); AllowAnonymous(); } public record DeleteSLAParameters( [property: FromHeader] string Login, [property: QueryParam] int SLAId ); protected override async Task> ExecuteAsync(DeleteSLAParameters req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _SLABLL.DeleteSLA(req.SLAId, 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); } } } }