backend/services: Move GetDashboard from sqlstore to dashboard service (#48971)
* rename folder to match package name * backend/sqlstore: move GetDashboard into DashboardService This is a stepping-stone commit which copies the GetDashboard function - which lets us remove the sqlstore from the interfaces in dashboards - without changing any other callers. * checkpoint: moving GetDashboard calls into dashboard service * finish refactoring api tests for dashboardService.GetDashboard
This commit is contained in:
@@ -31,7 +31,7 @@ func (hs *HTTPServer) SetHomeDashboard(c *models.ReqContext) response.Response {
|
||||
dashboardID := cmd.HomeDashboardID
|
||||
if cmd.HomeDashboardUID != nil {
|
||||
query := models.GetDashboardQuery{Uid: *cmd.HomeDashboardUID}
|
||||
err := hs.SQLStore.GetDashboard(c.Req.Context(), &query)
|
||||
err := hs.dashboardService.GetDashboard(c.Req.Context(), &query)
|
||||
if err != nil {
|
||||
return response.Error(404, "Dashboard not found", err)
|
||||
}
|
||||
@@ -65,7 +65,7 @@ func (hs *HTTPServer) getPreferencesFor(ctx context.Context, orgID, userID, team
|
||||
// when homedashboardID is 0, that means it is the default home dashboard, no UID would be returned in the response
|
||||
if preference.HomeDashboardID != 0 {
|
||||
query := models.GetDashboardQuery{Id: preference.HomeDashboardID, OrgId: orgID}
|
||||
err = hs.SQLStore.GetDashboard(ctx, &query)
|
||||
err = hs.dashboardService.GetDashboard(ctx, &query)
|
||||
if err == nil {
|
||||
dashboardUID = query.Result.Uid
|
||||
}
|
||||
@@ -104,7 +104,7 @@ func (hs *HTTPServer) updatePreferencesFor(ctx context.Context, orgID, userID, t
|
||||
dashboardID := dtoCmd.HomeDashboardID
|
||||
if dtoCmd.HomeDashboardUID != nil {
|
||||
query := models.GetDashboardQuery{Uid: *dtoCmd.HomeDashboardUID, OrgId: orgID}
|
||||
err := hs.SQLStore.GetDashboard(ctx, &query)
|
||||
err := hs.dashboardService.GetDashboard(ctx, &query)
|
||||
if err != nil {
|
||||
return response.Error(404, "Dashboard not found", err)
|
||||
}
|
||||
@@ -147,7 +147,7 @@ func (hs *HTTPServer) patchPreferencesFor(ctx context.Context, orgID, userID, te
|
||||
dashboardID := dtoCmd.HomeDashboardID
|
||||
if dtoCmd.HomeDashboardUID != nil {
|
||||
query := models.GetDashboardQuery{Uid: *dtoCmd.HomeDashboardUID, OrgId: orgID}
|
||||
err := hs.SQLStore.GetDashboard(ctx, &query)
|
||||
err := hs.dashboardService.GetDashboard(ctx, &query)
|
||||
if err != nil {
|
||||
return response.Error(404, "Dashboard not found", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user