Chore: Remove bus.Dispatch from provisioning services (#44989)

* make getordbyname a method

* remove one dispatch from plugins provisioner

* remove bus from the plugins provisioner, skip test for now

* remove bus from datasource provisioning

* resolve tests in notifier provisioning

* remove bus from the dashboards provisioning service

* fix missing struct field

* fix getorgbyid method calls

* pass org store into dashboard provisioner

* fix test function prototype

* fix tests

* attempt to fix tests after the rebase

* fix integration test

* avoid using transaction

* remove comments
This commit is contained in:
Serge Zaitsev
2022-02-23 11:12:37 +01:00
committed by GitHub
parent 49ac8b9f0a
commit a231c6861c
34 changed files with 445 additions and 377 deletions
+4 -4
View File
@@ -16,11 +16,11 @@ import (
const MainOrgName = "Main Org."
func (ss *SQLStore) addOrgQueryAndCommandHandlers() {
bus.AddHandler("sql", GetOrgById)
bus.AddHandler("sql", ss.GetOrgById)
bus.AddHandler("sql", CreateOrg)
bus.AddHandler("sql", ss.UpdateOrg)
bus.AddHandler("sql", ss.UpdateOrgAddress)
bus.AddHandler("sql", GetOrgByName)
bus.AddHandler("sql", ss.GetOrgByNameHandler)
bus.AddHandler("sql", ss.SearchOrgs)
bus.AddHandler("sql", ss.DeleteOrg)
}
@@ -48,7 +48,7 @@ func (ss *SQLStore) SearchOrgs(ctx context.Context, query *models.SearchOrgsQuer
return err
}
func GetOrgById(ctx context.Context, query *models.GetOrgByIdQuery) error {
func (ss *SQLStore) GetOrgById(ctx context.Context, query *models.GetOrgByIdQuery) error {
var org models.Org
exists, err := x.Id(query.Id).Get(&org)
if err != nil {
@@ -63,7 +63,7 @@ func GetOrgById(ctx context.Context, query *models.GetOrgByIdQuery) error {
return nil
}
func GetOrgByName(ctx context.Context, query *models.GetOrgByNameQuery) error {
func (ss *SQLStore) GetOrgByNameHandler(ctx context.Context, query *models.GetOrgByNameQuery) error {
var org models.Org
exists, err := x.Where("name=?", query.Name).Get(&org)
if err != nil {