Chore: Delete org model duplicates (#60940)

* Delete org model duplicates

* Fix lint

* Move OrgDetailsDTO to org pkg
This commit is contained in:
idafurjes
2023-01-04 16:20:26 +01:00
committed by GitHub
parent 39b8d3a182
commit bb35f37b66
22 changed files with 83 additions and 162 deletions
+6 -1
View File
@@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"strings"
"time"
"github.com/grafana/grafana/pkg/infra/db"
@@ -191,6 +192,10 @@ func (s *Service) GetByEmail(ctx context.Context, query *user.GetUserByEmailQuer
}
func (s *Service) Update(ctx context.Context, cmd *user.UpdateUserCommand) error {
if s.cfg.CaseInsensitiveLogin {
cmd.Login = strings.ToLower(cmd.Login)
cmd.Email = strings.ToLower(cmd.Email)
}
return s.store.Update(ctx, cmd)
}
@@ -440,7 +445,7 @@ func (s *Service) CreateUserForTests(ctx context.Context, cmd *user.CreateUserCo
func (s *Service) getOrgIDForNewUser(ctx context.Context, cmd *user.CreateUserCommand) (int64, error) {
if s.cfg.AutoAssignOrg && cmd.OrgID != 0 {
if _, err := s.orgService.GetByID(ctx, &org.GetOrgByIdQuery{ID: cmd.OrgID}); err != nil {
if _, err := s.orgService.GetByID(ctx, &org.GetOrgByIDQuery{ID: cmd.OrgID}); err != nil {
return -1, err
}
return cmd.OrgID, nil