From 1cf828961d8e9ad4afe70106c71b61a1d4dcdc00 Mon Sep 17 00:00:00 2001 From: the_aceix Date: Thu, 24 Oct 2024 05:26:35 +0000 Subject: [PATCH] fix(NET-1613): patch api responses fot create and update tags --- controllers/tags.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/controllers/tags.go b/controllers/tags.go index 2def88f68..f073f382a 100644 --- a/controllers/tags.go +++ b/controllers/tags.go @@ -130,7 +130,13 @@ func createTag(w http.ResponseWriter, r *http.Request) { } }() - logic.ReturnSuccessResponseWithJson(w, r, req, "created tag successfully") + var res models.TagListRespNodes = models.TagListRespNodes{ + Tag: tag, + UsedByCnt: len(req.TaggedNodes), + TaggedNodes: req.TaggedNodes, + } + + logic.ReturnSuccessResponseWithJson(w, r, res, "created tag successfully") } // @Summary Update Tag @@ -175,7 +181,14 @@ func updateTag(w http.ResponseWriter, r *http.Request) { logic.DeleteTag(updateTag.ID) } go logic.UpdateTag(updateTag, newID) - logic.ReturnSuccessResponse(w, r, "updating tags") + + var res models.TagListRespNodes = models.TagListRespNodes{ + Tag: tag, + UsedByCnt: len(updateTag.TaggedNodes), + TaggedNodes: updateTag.TaggedNodes, + } + + logic.ReturnSuccessResponseWithJson(w, r, res, "updated tags") } // @Summary Delete Tag