Chore: Remove bus from signup and playlist api (#44485)

* Remove bus from signup and playlist api

* Remove bus from playlist play
This commit is contained in:
idafurjes
2022-01-27 10:33:02 +01:00
committed by GitHub
parent 28c51cde3a
commit 82892331c1
8 changed files with 52 additions and 54 deletions
+2 -2
View File
@@ -28,7 +28,6 @@ var shadowSearchCounter = prometheus.NewCounterVec(
func init() {
bus.AddHandler("sql", GetDashboard)
bus.AddHandler("sql", GetDashboards)
bus.AddHandler("sql", GetDashboardTags)
bus.AddHandler("sql", GetDashboardSlugById)
bus.AddHandler("sql", GetDashboardsByPluginId)
@@ -44,6 +43,7 @@ func (ss *SQLStore) addDashboardQueryAndCommandHandlers() {
bus.AddHandler("sql", ss.GetDashboardUIDById)
bus.AddHandler("sql", ss.SearchDashboards)
bus.AddHandler("sql", ss.DeleteDashboard)
bus.AddHandler("sql", ss.GetDashboards)
}
var generateNewUid func() string = util.GenerateShortUID
@@ -509,7 +509,7 @@ func deleteDashboard(cmd *models.DeleteDashboardCommand, sess *DBSession) error
return nil
}
func GetDashboards(ctx context.Context, query *models.GetDashboardsQuery) error {
func (ss *SQLStore) GetDashboards(ctx context.Context, query *models.GetDashboardsQuery) error {
if len(query.DashboardIds) == 0 {
return models.ErrCommandValidationFailed
}
@@ -75,7 +75,7 @@ func TestDashboardProvisioningTest(t *testing.T) {
require.Nil(t, err)
query := &models.GetDashboardsQuery{DashboardIds: []int64{anotherDash.Id}}
err = GetDashboards(context.Background(), query)
err = sqlStore.GetDashboards(context.Background(), query)
require.Nil(t, err)
require.NotNil(t, query.Result)
@@ -83,7 +83,7 @@ func TestDashboardProvisioningTest(t *testing.T) {
require.Nil(t, sqlStore.DeleteOrphanedProvisionedDashboards(context.Background(), deleteCmd))
query = &models.GetDashboardsQuery{DashboardIds: []int64{dash.Id, anotherDash.Id}}
err = GetDashboards(context.Background(), query)
err = sqlStore.GetDashboards(context.Background(), query)
require.Nil(t, err)
require.Equal(t, 1, len(query.Result))