diff --git a/graph/pkg/service/v0/service.go b/graph/pkg/service/v0/service.go index 79d01afa27..ee9d8b1c65 100644 --- a/graph/pkg/service/v0/service.go +++ b/graph/pkg/service/v0/service.go @@ -2,6 +2,7 @@ package svc import ( "net/http" + "strings" "github.com/owncloud/ocis/ocis-pkg/account" opkgm "github.com/owncloud/ocis/ocis-pkg/middleware" @@ -60,6 +61,33 @@ func NewService(opts ...Option) Service { ) r.Post("/", svc.CreateDrive) }) + r.Route("/Drive({id})", func(r chi.Router) { + r.Use(opkgm.ExtractAccountUUID( + account.Logger(options.Logger), + account.JWTSecret(options.Config.TokenManager.JWTSecret)), + ) + r.Patch("/", func(w http.ResponseWriter, r *http.Request) { + d := strings.ReplaceAll(chi.URLParam(r, "id"), `"`, "") + /* + 1. get storage space by id + 2. prepare UpdateStorageSpaceRequest + 3. get a reva client + 4. do UpdateStorageSpace request + + Known loose ends: + 1. Reva's FS interface does not yet contain UpdateStorageSpace. Needs to be added. + 2. There are many ways to select a resource on OData. Because spaces names are not unique, we will support + unique updates and not bulk updates. Supported URLs look like: + + https://localhost:9200/graph/v1.0/DriveById(id=1284d238-aa92-42ce-bdc4-0b0000009157!cdf8d353-dd02-46ed-b06a-3bb66f29743c) + + 3. How are uploading images to the space being handled? Since an image is not a property of the Drive (speaking OData) + it can be handled directly by doing an upload to the storage itself. + */ + _, _ = w.Write([]byte(d)) + w.WriteHeader(http.StatusOK) + }) + }) }) })