Nested Folders: More API fixes (#59316)

* Nested Folder: Fix create, use camel case for JSON properties

* Fix get parents if the folder does not exist

* Add store test for get parents
This commit is contained in:
Sofia Papagiannaki
2022-11-24 13:28:53 -05:00
committed by GitHub
parent 5a3f0e8696
commit f5c41ea497
7 changed files with 310 additions and 288 deletions
+2 -1
View File
@@ -3,6 +3,7 @@ package folderimpl
import (
"context"
"errors"
"fmt"
"strings"
"github.com/grafana/grafana/pkg/bus"
@@ -517,7 +518,7 @@ func (s *Service) nestedFolderCreate(ctx context.Context, cmd *folder.CreateFold
func (s *Service) validateParent(ctx context.Context, orgID int64, parentUID string) error {
ancestors, err := s.store.GetParents(ctx, folder.GetParentsQuery{UID: parentUID, OrgID: orgID})
if err != nil {
return err
return fmt.Errorf("failed to get parents: %w", err)
}
if len(ancestors) == folder.MaxNestedFolderDepth {