This commit is contained in:
@@ -267,21 +267,22 @@ namespace AyaNova.Api.Controllers
|
||||
return Accepted(new { JobId = result });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Attempt cancel render job
|
||||
/// </summary>
|
||||
/// <param name="gid"></param>
|
||||
/// <returns>nothing</returns>
|
||||
[HttpGet("request-cancel/{gid}")]
|
||||
[HttpPost("request-cancel/{gid}")]
|
||||
public async Task<IActionResult> RequestCancelJob([FromRoute] Guid gid)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
ReportBiz biz = ReportBiz.GetBiz(ct, HttpContext);
|
||||
if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
log.LogDebug($"request-cancel called for report rendering job id {gid}");
|
||||
await biz.CancelJob(gid);
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user