mirror of
https://github.com/grafana/grafana.git
synced 2025-08-03 05:37:53 +08:00
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:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user