Nested Folders: Some API fixes (#59298)

* Nested Folders: Fix API responses

* Fix panic during deletions

* Add test
This commit is contained in:
Sofia Papagiannaki
2022-11-24 15:59:47 +02:00
committed by GitHub
parent 1a6b46e98d
commit 8e6d343981
4 changed files with 35 additions and 16 deletions

View File

@@ -20,10 +20,10 @@ type Folder struct {
Created time.Time `json:"created"`
UpdatedBy string `json:"updatedBy"`
Updated time.Time `json:"updated"`
Version int `json:"version"`
Version int `json:"version,omitempty"`
AccessControl accesscontrol.Metadata `json:"accessControl,omitempty"`
// only used if nested folders are enabled
ParentUID string `json:"parentUid"`
ParentUID string `json:"parentUid,omitempty"`
}
type FolderSearchHit struct {

View File

@@ -251,6 +251,7 @@ func (hs *HTTPServer) newToFolderDto(c *models.ReqContext, g guardian.DashboardG
Updated: folder.Updated,
Version: folder.Version,
AccessControl: hs.getAccessControlMetadata(c, c.OrgID, dashboards.ScopeFoldersPrefix, folder.UID),
ParentUID: folder.ParentUID,
}
}