From 6125717ba9cc812267fd5f1a164db127dfd73925 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sat, 16 May 2020 14:19:34 +0000 Subject: [PATCH] Bulk tag ops --- server/AyaNova/Controllers/TagController.cs | 9 +++++---- server/AyaNova/biz/TagUtil.cs | 7 +++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/server/AyaNova/Controllers/TagController.cs b/server/AyaNova/Controllers/TagController.cs index cbb85ae9..14980069 100644 --- a/server/AyaNova/Controllers/TagController.cs +++ b/server/AyaNova/Controllers/TagController.cs @@ -77,10 +77,11 @@ namespace AyaNova.Api.Controllers /// Bulk add tags to objects /// /// Required - /// Required + /// Required + /// Required /// Number of items affected - [HttpPost("bulk-add/{ayaType}")] - public async Task BulkAdd([FromRoute] AyaType ayaType, [FromBody] TagUtil.BulkTagOpParameter tagOpParams) + [HttpPost("bulk-add/{ayaType}/{tag}")] + public async Task BulkAdd([FromRoute] AyaType ayaType, [FromRoute] string tag, [FromBody] List 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)); } diff --git a/server/AyaNova/biz/TagUtil.cs b/server/AyaNova/biz/TagUtil.cs index 49add26e..77d922b3 100644 --- a/server/AyaNova/biz/TagUtil.cs +++ b/server/AyaNova/biz/TagUtil.cs @@ -215,7 +215,7 @@ namespace AyaNova.Biz //BULK OPS // - public static async Task BulkAdd(AyaType ayaType, BulkTagOpParameter tagOpParams, AyContext ct) + public static async Task BulkAdd(AyaType ayaType, string tag, List 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 @@ -224,9 +224,8 @@ namespace AyaNova.Biz } - public class BulkTagOpParameter - { - public string NewTag { get; set; } + public class ObjectIdList + { public List ObjectIds { get; set; } }