This commit is contained in:
2020-05-16 14:27:56 +00:00
parent 4b4a4ad5cf
commit 37a0cf6118
2 changed files with 51 additions and 0 deletions

View File

@@ -111,6 +111,43 @@ namespace AyaNova.Api.Controllers
}
/// <summary>
/// Bulk remove tags to list of object id's specified
/// </summary>
/// <param name="ayaType">Required</param>
/// <param name="tag">Required</param>
/// <param name="idList">Required</param>
/// <returns>Number of items affected</returns>
[HttpPost("bulk-remove/{ayaType}/{tag}")]
public async Task<IActionResult> BulkRemove([FromRoute] AyaType ayaType, [FromRoute] string tag, [FromBody] List<long> idList)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
if (!Authorized.HasModifyRole(HttpContext.Items, ayaType))
return StatusCode(403, new ApiNotAuthorizedResponse());
return Ok(ApiOkResponse.Response(await TagUtil.BulkRemove(ayaType, tag, idList, ct), true));
}
/// <summary>
/// Bulk remove tags to all objects of type specified
/// </summary>
/// <param name="ayaType">Required</param>
/// <param name="tag">Required</param>
/// <returns>Number of items affected</returns>
[HttpPost("bulk-remove-any/{ayaType}/{tag}")]
public async Task<IActionResult> BulkRemoveAny([FromRoute] AyaType ayaType, [FromRoute] string tag)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
if (!Authorized.HasModifyRole(HttpContext.Items, ayaType))
return StatusCode(403, new ApiNotAuthorizedResponse());
return Ok(ApiOkResponse.Response(await TagUtil.BulkRemoveAny(ayaType, tag, ct), true));
}

View File

@@ -229,6 +229,20 @@ namespace AyaNova.Biz
}
public static async Task<long> BulkRemove(AyaType ayaType, string tag, List<long> idList, AyContext ct)
{
//todo iterate the object in question, open and update and save each one through it's biz object interface so rules etc are all maintained
//not sure if should update locked or read only objects, probably not I guess as it should only do whatever was done in interface
throw new System.NotImplementedException("NOT IMPLEMENTED YET");
}
public static async Task<long> BulkRemoveAny(AyaType ayaType, string tag, AyContext ct)
{
throw new System.NotImplementedException("NOT IMPLEMENTED YET");
}
}//eoc