LoginService: Remove unused sqlstore (#58595)

Remove unused sqlstore
This commit is contained in:
Selene 2022-11-23 17:58:52 +01:00 committed by GitHub
parent d33b4918cd
commit 9dc82606db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 7 deletions

View File

@ -10,7 +10,6 @@ import (
"github.com/grafana/grafana/pkg/services/login"
"github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/quota"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/services/user"
)
@ -19,7 +18,6 @@ var (
)
func ProvideService(
sqlStore sqlstore.Store,
userService user.Service,
quotaService quota.Service,
authInfoService login.AuthInfoService,
@ -27,7 +25,6 @@ func ProvideService(
orgService org.Service,
) *Implementation {
s := &Implementation{
SQLStore: sqlStore,
userService: userService,
QuotaService: quotaService,
AuthInfoService: authInfoService,
@ -38,7 +35,6 @@ func ProvideService(
}
type Implementation struct {
SQLStore sqlstore.Store
userService user.Service
AuthInfoService login.AuthInfoService
QuotaService quota.Service
@ -49,7 +45,7 @@ type Implementation struct {
// CreateUser creates inserts a new one.
func (ls *Implementation) CreateUser(cmd user.CreateUserCommand) (*user.User, error) {
return ls.SQLStore.CreateUser(context.Background(), cmd)
return ls.userService.Create(context.Background(), &cmd)
}
// UpsertUser updates an existing user, or if it doesn't exist, inserts a new one.

View File

@ -28,7 +28,6 @@ func Test_syncOrgRoles_doesNotBreakWhenTryingToRemoveLastOrgAdmin(t *testing.T)
login := Implementation{
QuotaService: quotatest.New(false, nil),
AuthInfoService: authInfoMock,
SQLStore: nil,
userService: usertest.NewUserServiceFake(),
orgService: orgtest.NewOrgServiceFake(),
}
@ -53,7 +52,6 @@ func Test_syncOrgRoles_whenTryingToRemoveLastOrgLogsError(t *testing.T) {
login := Implementation{
QuotaService: quotatest.New(false, nil),
AuthInfoService: authInfoMock,
SQLStore: nil,
userService: usertest.NewUserServiceFake(),
orgService: orgService,
}