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 08:40:46 -04:00
committed by GitHub
parent b0cb02568a
commit ef651daed2
20 changed files with 164 additions and 267 deletions
@@ -13,6 +13,7 @@ import (
"github.com/grafana/grafana/pkg/services/alerting"
"github.com/grafana/grafana/pkg/services/encryption"
"github.com/grafana/grafana/pkg/services/notifications"
"github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/provisioning/utils"
"github.com/grafana/grafana/pkg/setting"
"gopkg.in/yaml.v2"
@@ -21,7 +22,7 @@ import (
type configReader struct {
encryptionService encryption.Internal
notificationService *notifications.NotificationService
orgStore utils.OrgStore
orgService org.Service
log log.Logger
}
@@ -94,7 +95,7 @@ func (cr *configReader) checkOrgIDAndOrgName(ctx context.Context, notifications
notification.OrgID = 0
}
} else {
if err := utils.CheckOrgExists(ctx, cr.orgStore, notification.OrgID); err != nil {
if err := utils.CheckOrgExists(ctx, cr.orgService, notification.OrgID); err != nil {
return fmt.Errorf("failed to provision %q notification: %w", notification.Name, err)
}
}