move GetDashboardUIDById out of sqlstore and into dashboard service (#49170)

* sqlstore: move GetDashboardUIDById to dashboard service
* winding change through the rest of the codebase
This commit is contained in:
Kristin Laemmert
2022-05-19 10:13:02 -04:00
committed by GitHub
parent 0bad187a60
commit 2b8909a9c6
26 changed files with 154 additions and 117 deletions
@@ -889,3 +889,18 @@ func (d *DashboardStore) GetDashboard(ctx context.Context, query *models.GetDash
return nil
})
}
func (d *DashboardStore) GetDashboardUIDById(ctx context.Context, query *models.GetDashboardRefByIdQuery) error {
return d.sqlStore.WithDbSession(ctx, func(sess *sqlstore.DBSession) error {
var rawSQL = `SELECT uid, slug from dashboard WHERE Id=?`
us := &models.DashboardRef{}
exists, err := sess.SQL(rawSQL, query.Id).Get(us)
if err != nil {
return err
} else if !exists {
return models.ErrDashboardNotFound
}
query.Result = us
return nil
})
}