Folder store (#46431)

* create FolderStore
* update usages to provide context
* implement methods to get folder by ID and UID
* update folder service to use store methods
This commit is contained in:
Yuriy Tseretyan
2022-03-14 11:21:42 -04:00
committed by GitHub
parent 0b0d612372
commit 9465eb1b3a
10 changed files with 441 additions and 126 deletions
+25
View File
@@ -33,6 +33,31 @@ type Folder struct {
HasAcl bool
}
// NewFolder creates a new Folder
func NewFolder(title string) *Folder {
folder := &Folder{}
folder.Title = title
folder.Created = time.Now()
folder.Updated = time.Now()
return folder
}
// DashboardToFolder converts Dashboard to Folder
func DashboardToFolder(dash *Dashboard) *Folder {
return &Folder{
Id: dash.Id,
Uid: dash.Uid,
Title: dash.Title,
HasAcl: dash.HasAcl,
Url: dash.GetUrl(),
Version: dash.Version,
Created: dash.Created,
CreatedBy: dash.CreatedBy,
Updated: dash.Updated,
UpdatedBy: dash.UpdatedBy,
}
}
// UpdateDashboardModel updates an existing model from command into model for update
func (cmd *UpdateFolderCommand) UpdateDashboardModel(dashFolder *Dashboard, orgId int64, userId int64) {
dashFolder.OrgId = orgId