Bulk tag ops

This commit is contained in:
2020-05-16 14:19:34 +00:00
parent c574f3722b
commit 6125717ba9
2 changed files with 8 additions and 8 deletions

View File

@@ -77,10 +77,11 @@ namespace AyaNova.Api.Controllers
/// Bulk add tags to objects
/// </summary>
/// <param name="ayaType">Required</param>
/// <param name="tagOpParams">Required</param>
/// <param name="tag">Required</param>
/// <param name="idList">Required</param>
/// <returns>Number of items affected</returns>
[HttpPost("bulk-add/{ayaType}")]
public async Task<IActionResult> BulkAdd([FromRoute] AyaType ayaType, [FromBody] TagUtil.BulkTagOpParameter tagOpParams)
[HttpPost("bulk-add/{ayaType}/{tag}")]
public async Task<IActionResult> BulkAdd([FromRoute] AyaType ayaType, [FromRoute] string tag, [FromBody] List<long> idList)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
@@ -88,7 +89,7 @@ namespace AyaNova.Api.Controllers
return BadRequest(new ApiErrorResponse(ModelState));
if (!Authorized.HasModifyRole(HttpContext.Items, ayaType))
return StatusCode(403, new ApiNotAuthorizedResponse());
return Ok(ApiOkResponse.Response(await TagUtil.BulkAdd(ayaType, tagOpParams, ct), true));
return Ok(ApiOkResponse.Response(await TagUtil.BulkAdd(ayaType, tag, idList, ct), true));
}