Folder: Add implementation for Update for nested folder (#58479)

* Add implementation for Update nested folder

* Remove parent uid from Update

* Fix update
This commit is contained in:
idafurjes
2022-11-10 14:28:55 +01:00
committed by GitHub
parent bd6ac793a0
commit 30f0d66983
8 changed files with 69 additions and 54 deletions

View File

@@ -151,12 +151,12 @@ func (hs *HTTPServer) UpdateFolder(c *models.ReqContext) response.Response {
if err := web.Bind(c.Req, &cmd); err != nil {
return response.Error(http.StatusBadRequest, "bad request data", err)
}
err := hs.folderService.UpdateFolder(c.Req.Context(), c.SignedInUser, c.OrgID, web.Params(c.Req)[":uid"], &cmd)
result, err := hs.folderService.Update(c.Req.Context(), c.SignedInUser, c.OrgID, web.Params(c.Req)[":uid"], &cmd)
if err != nil {
return apierrors.ToFolderErrorResponse(err)
}
g := guardian.New(c.Req.Context(), cmd.Result.Id, c.OrgID, c.SignedInUser)
return response.JSON(http.StatusOK, hs.toFolderDto(c, g, cmd.Result))
g := guardian.New(c.Req.Context(), result.Id, c.OrgID, c.SignedInUser)
return response.JSON(http.StatusOK, hs.toFolderDto(c, g, result))
}
// swagger:route DELETE /folders/{folder_uid} folders deleteFolder