using FastEndpoints; using FrameworkBLL.SystemJob; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using FrameworkDAL.Constant; using static FrameworkDAL.Constant.Constant; namespace FrameworkSL.Endpoints.SystemJob { public class DeleteSystemJob : BaseEndpoint> { public readonly ISystemJobBLL _SystemJobBLL; public DeleteSystemJob(ISystemJobBLL ISystemJobBLL) { _SystemJobBLL = ISystemJobBLL; } public override void Configure() { Delete("/SystemJob/DeleteSystemJob"); AllowAnonymous(); } public record DeleteSystemJobParameters( [property: FromHeader] string Login, [property: QueryParam] int SysJobId ); protected override async Task> ExecuteAsync(DeleteSystemJobParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _SystemJobBLL.DeleteSystemJob(req.SysJobId, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.UserLevel, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.UserLevel, LoginDTO, ex.Message, 500); } } } }