using FastEndpoints; using FrameworkBLL.AutoScheduler; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.JobDefine { public class DeleteJobDefine : BaseEndpoint> { private readonly IAutoSchedulerBLL _bll; public DeleteJobDefine(IAutoSchedulerBLL bll) => _bll = bll; public override void Configure() { Delete("/JobDefine/DeleteJobDefine"); AllowAnonymous(); } public record Parameters( [property: FromHeader] string Login, [property: QueryParam] int JobId ); protected override string? GetCacheKey(Parameters req, LoginDTO login) => null; protected override async Task> ExecuteAsync( Parameters req, LoginDTO login, CancellationToken ct) { var result = await _bll.DeleteJobDefineAsync(req.JobId, login, ct); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.NOT_REQUIRED, login); } } }