Chore: Deprecate ID from Folder (#78281)

* Chore: Deprecate ID from Folder

* chore: add more linter comments

* chore: add missing lint comment
This commit is contained in:
Kat Yang
2023-11-20 15:44:51 -05:00
committed by GitHub
parent ae164df698
commit 2f2ce3edbb
34 changed files with 128 additions and 20 deletions
+5 -1
View File
@@ -173,6 +173,7 @@ func (s *Service) Get(ctx context.Context, cmd *folder.GetFolderQuery) (*folder.
}
// always expose the dashboard store sequential ID
// nolint:staticcheck
f.ID = dashFolder.ID
f.Version = dashFolder.Version
@@ -225,6 +226,7 @@ func (s *Service) GetChildren(ctx context.Context, cmd *folder.GetChildrenQuery)
}
// always expose the dashboard store sequential ID
// nolint:staticcheck
f.ID = dashFolder.ID
if cmd.UID != "" {
@@ -443,7 +445,7 @@ func (s *Service) Create(ctx context.Context, cmd *folder.CreateFolderCommand) (
logger.Error("error saving folder to nested folder store", "error", err)
// do not shallow create error if the legacy folder delete fails
if deleteErr := s.dashboardStore.DeleteDashboard(ctx, &dashboards.DeleteDashboardCommand{
ID: createdFolder.ID,
ID: createdFolder.ID, // nolint:staticcheck
OrgID: createdFolder.OrgID,
}); deleteErr != nil {
logger.Error("error deleting folder after failed save to nested folder store", "error", err)
@@ -488,6 +490,7 @@ func (s *Service) Update(ctx context.Context, cmd *folder.UpdateFolderCommand) (
}
// always expose the dashboard store sequential ID
// nolint:staticcheck
foldr.ID = dashFolder.ID
foldr.Version = dashFolder.Version
@@ -660,6 +663,7 @@ func (s *Service) deleteChildrenInFolder(ctx context.Context, orgID int64, folde
}
func (s *Service) legacyDelete(ctx context.Context, cmd *folder.DeleteFolderCommand, dashFolder *folder.Folder) error {
// nolint:staticcheck
deleteCmd := dashboards.DeleteDashboardCommand{OrgID: cmd.OrgID, ID: dashFolder.ID, ForceDeleteFolderRules: cmd.ForceDeleteRules}
if err := s.dashboardStore.DeleteDashboard(ctx, &deleteCmd); err != nil {