mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
* Chore: Remove Result from dashboard models * Fix lint tests * Fix dashboard service tests * Fix API tests * Remove commented out code * Chore: Merge main - cleanup
27 lines
635 B
Go
27 lines
635 B
Go
package utils
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
|
|
"github.com/grafana/grafana/pkg/services/dashboards"
|
|
"github.com/grafana/grafana/pkg/services/org"
|
|
)
|
|
|
|
type DashboardStore interface {
|
|
GetDashboard(context.Context, *dashboards.GetDashboardQuery) (*dashboards.Dashboard, error)
|
|
}
|
|
|
|
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, org.ErrOrgNotFound) {
|
|
return err
|
|
}
|
|
return fmt.Errorf("failed to check whether org. with the given ID exists: %w", err)
|
|
}
|
|
return nil
|
|
}
|