using FastEndpoints; using FrameworkBLL.ParameterSet; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static FrameworkDAL.Constant.Constant; namespace FrameworkSL.Endpoints.ParameterSet { public class DeleteParameterSet : BaseEndpoint> { private readonly IParameterSetBLL _ParameterSetBLL; public DeleteParameterSet(IParameterSetBLL ParameterSetBLL) { _ParameterSetBLL = ParameterSetBLL; } public override void Configure() { Delete("/ParameterSet/DeleteParameterSet"); AllowAnonymous(); } public record DeleteParameterSetParameters( [property: FromHeader] string Login, [property: QueryParam] int ParameterSetId ); protected override async Task> ExecuteAsync(DeleteParameterSetParameters req, LoginDTO loginDTO, CancellationToken ct) { try { var result = await _ParameterSetBLL.DeleteParameterSet(req.ParameterSetId, loginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(result, CacheKeyLevel.NotRequired, loginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.NotRequired, loginDTO, ex.Message, 500); } } } }