using FastEndpoints; using FrameworkBLL.SysJobRun; using FrameworkDAL.DTO.SysJobRun; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using System; using System.Threading; using System.Threading.Tasks; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Endpoints.SysJobRun { public class SaveSysJobRun : BaseEndpoint> { private readonly ISysJobRunBLL _SysJobRunBLL; public SaveSysJobRun(ISysJobRunBLL SysJobRunBLL) { _SysJobRunBLL = SysJobRunBLL; } public override void Configure() { Post("/SysJobRun/SaveSysJobRun"); AllowAnonymous(); } public record SaveSysJobRunParameters( [property: FromHeader] string Login, [property: FromBody] SysJobRunDTO SysJobRunDTO ); protected override async Task> ExecuteAsync(SaveSysJobRunParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _SysJobRunBLL.SaveSysJobRun(req.SysJobRunDTO, LoginDTO!); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse(Result, CacheKeyLevel.USER_LEVEL, LoginDTO); } catch (Exception ex) { return await GB5Shared.ResponseStandard.Response.CreateExceptionError(ex, CacheKeyLevel.USER_LEVEL, LoginDTO, ex.Message, 500); } } } }