This commit is contained in:
2020-05-23 18:39:39 +00:00
parent 65479bd903
commit 60aa652b9d
6 changed files with 63 additions and 62 deletions

View File

@@ -212,29 +212,7 @@ namespace AyaNova.Api.Controllers
}
/// <summary>
/// Get route that submits a simulated long running operation job for testing
/// </summary>
/// <returns>Nothing</returns>
[HttpGet("testwidgetjob")]
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());
//Create the job here
OpsJob j = new OpsJob();
j.Name = "TestWidgetJob";
j.JobType = JobType.TestWidgetJob;
await JobsBiz.AddJobAsync(j, ct);
//Log
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
}
//------------