backend/sqlstore: move GetDashboards to Dashboard Service (#49175)
I also did some mild file renaming to try and get the dashboards package closer in line with the sqlstore split design doc.
This commit is contained in:
@@ -4,8 +4,6 @@ import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"xorm.io/xorm"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
@@ -201,26 +199,6 @@ func (ss *SQLStore) GetDashboardTags(ctx context.Context, query *models.GetDashb
|
||||
})
|
||||
}
|
||||
|
||||
func (ss *SQLStore) GetDashboards(ctx context.Context, query *models.GetDashboardsQuery) error {
|
||||
return ss.WithDbSession(ctx, func(dbSession *DBSession) error {
|
||||
if len(query.DashboardIds) == 0 && len(query.DashboardUIds) == 0 {
|
||||
return models.ErrCommandValidationFailed
|
||||
}
|
||||
|
||||
var dashboards = make([]*models.Dashboard, 0)
|
||||
var session *xorm.Session
|
||||
if len(query.DashboardIds) > 0 {
|
||||
session = dbSession.In("id", query.DashboardIds)
|
||||
} else {
|
||||
session = dbSession.In("uid", query.DashboardUIds)
|
||||
}
|
||||
|
||||
err := session.Find(&dashboards)
|
||||
query.Result = dashboards
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
// GetDashboardPermissionsForUser returns the maximum permission the specified user has for a dashboard(s)
|
||||
// The function takes in a list of dashboard ids and the user id and role
|
||||
func (ss *SQLStore) GetDashboardPermissionsForUser(ctx context.Context, query *models.GetDashboardPermissionsForUserQuery) error {
|
||||
|
||||
@@ -98,7 +98,6 @@ type Store interface {
|
||||
RemoveOrgUser(ctx context.Context, cmd *models.RemoveOrgUserCommand) error
|
||||
GetDashboardTags(ctx context.Context, query *models.GetDashboardTagsQuery) error
|
||||
SearchDashboards(ctx context.Context, query *models.FindPersistedDashboardsQuery) error
|
||||
GetDashboards(ctx context.Context, query *models.GetDashboardsQuery) error
|
||||
GetDataSource(ctx context.Context, query *models.GetDataSourceQuery) error
|
||||
GetDataSources(ctx context.Context, query *models.GetDataSourcesQuery) error
|
||||
GetDataSourcesByType(ctx context.Context, query *models.GetDataSourcesByTypeQuery) error
|
||||
|
||||
Reference in New Issue
Block a user