This commit is contained in:
@@ -134,7 +134,24 @@ namespace AyaNova.Api.Controllers
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Trigger a test job that simulates a (30 second) long running operation for testing and ops confirmation
|
||||
/// </summary>
|
||||
/// <returns>Job id</returns>
|
||||
[HttpPost("test-job")]
|
||||
public async Task<IActionResult> TestWidgetJob()
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
if (!Authorized.HasModifyRole(HttpContext.Items, AyaType.ServerJob))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
OpsJob j = new OpsJob();
|
||||
j.Name = "TestJob";
|
||||
j.JobType = JobType.TestJob;
|
||||
await JobsBiz.AddJobAsync(j, ct);
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.ServerJob, AyaEvent.Created, $"{j.JobType} {j.Name}"), ct);
|
||||
return Accepted(new { JobId = j.GId });//202 accepted
|
||||
}
|
||||
|
||||
//------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user