Use org service instead of sqlstore (#56407)

* Use org service instead of sqlstore

* Remove methods from sqlstore

* Remove commented out code

* Fix lint

* Fix lint 2
This commit is contained in:
idafurjes
2022-10-13 14:40:46 +02:00
committed by GitHub
parent b0cb02568a
commit ef651daed2
20 changed files with 164 additions and 267 deletions

View File

@ -6,19 +6,17 @@ import (
"fmt"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/org"
)
type OrgStore interface {
GetOrgById(context.Context, *models.GetOrgByIdQuery) error
}
type DashboardStore interface {
GetDashboard(context.Context, *models.GetDashboardQuery) error
}
func CheckOrgExists(ctx context.Context, store OrgStore, orgID int64) error {
query := models.GetOrgByIdQuery{Id: orgID}
if err := store.GetOrgById(ctx, &query); err != nil {
func CheckOrgExists(ctx context.Context, orgService org.Service, orgID int64) error {
query := org.GetOrgByIdQuery{ID: orgID}
_, err := orgService.GetByID(ctx, &query)
if err != nil {
if errors.Is(err, models.ErrOrgNotFound) {
return err
}