using FastEndpoints; using FrameworkBLL.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 GetSysJobRun : BaseEndpoint> { private readonly ISysJobRunBLL _SysJobRunBLL; public GetSysJobRun(ISysJobRunBLL ISysJobRunBLL) { _SysJobRunBLL = ISysJobRunBLL; } public override void Configure() { Get("/SysJobRun/GetSysJobRun"); AllowAnonymous(); } public record GetSysJobRunParameters( [property: FromHeader] string Login, [property: QueryParam] int SysJobRunId ); protected override async Task> ExecuteAsync(GetSysJobRunParameters req, LoginDTO LoginDTO, CancellationToken ct) { try { var Result = await _SysJobRunBLL.GetSysJobRun(req.SysJobRunId, 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); } } } }