Bulk tag ops
This commit is contained in:
@@ -77,10 +77,11 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// Bulk add tags to objects
|
/// Bulk add tags to objects
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ayaType">Required</param>
|
/// <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>
|
/// <returns>Number of items affected</returns>
|
||||||
[HttpPost("bulk-add/{ayaType}")]
|
[HttpPost("bulk-add/{ayaType}/{tag}")]
|
||||||
public async Task<IActionResult> BulkAdd([FromRoute] AyaType ayaType, [FromBody] TagUtil.BulkTagOpParameter tagOpParams)
|
public async Task<IActionResult> BulkAdd([FromRoute] AyaType ayaType, [FromRoute] string tag, [FromBody] List<long> idList)
|
||||||
{
|
{
|
||||||
if (!serverState.IsOpen)
|
if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||||
@@ -88,7 +89,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
if (!Authorized.HasModifyRole(HttpContext.Items, ayaType))
|
if (!Authorized.HasModifyRole(HttpContext.Items, ayaType))
|
||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ namespace AyaNova.Biz
|
|||||||
//BULK OPS
|
//BULK OPS
|
||||||
//
|
//
|
||||||
|
|
||||||
public static async Task<long> BulkAdd(AyaType ayaType, BulkTagOpParameter tagOpParams, AyContext ct)
|
public static async Task<long> BulkAdd(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
|
//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
|
//not sure if should update locked or read only objects, probably not I guess as it should only do whatever was done in interface
|
||||||
@@ -224,9 +224,8 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class BulkTagOpParameter
|
public class ObjectIdList
|
||||||
{
|
{
|
||||||
public string NewTag { get; set; }
|
|
||||||
public List<long> ObjectIds { get; set; }
|
public List<long> ObjectIds { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user