X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=lib%2Fapiv1%2Ffolders.go;h=073445c3934e7e93c9221d612f722e9907218f7e;hb=67a7d6e46143410a5fa9cfa2554023ab7687ea34;hp=398e21cfa6a286d70905480ed6422a3f29e7838d;hpb=d2335afe1058153a3aad27fa483499b0639e096c;p=src%2Fxds%2Fxds-server.git diff --git a/lib/apiv1/folders.go b/lib/apiv1/folders.go index 398e21c..073445c 100644 --- a/lib/apiv1/folders.go +++ b/lib/apiv1/folders.go @@ -105,3 +105,27 @@ func (s *APIService) delFolder(c *gin.Context) { } c.JSON(http.StatusOK, delEntry) } + +// updateFolder update some field of a folder +func (s *APIService) updateFolder(c *gin.Context) { + id, err := s.mfolders.ResolveID(c.Param("id")) + if err != nil { + common.APIError(c, err.Error()) + return + } + + s.log.Debugln("Update folder id ", id) + + var cfgArg folder.FolderConfig + if c.BindJSON(&cfgArg) != nil { + common.APIError(c, "Invalid arguments") + return + } + + upFld, err := s.mfolders.Update(id, cfgArg) + if err != nil { + common.APIError(c, err.Error()) + return + } + c.JSON(http.StatusOK, upFld) +}