Skip to content

Commit

Permalink
Merge pull request #3167 from gravitl/fix/NET-1613
Browse files Browse the repository at this point in the history
fix(NET-1613): patch api responses for create and update tags
  • Loading branch information
abhishek9686 authored Oct 27, 2024
2 parents d8a0398 + 1cf8289 commit 9a45c51
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions controllers/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9a45c51

Please sign in to comment.