Chore: Add methods from sqlstore to org service interface (#55635)
* Chore: Copy methods from sqlstore to org store * Rename method, add test * Add comments of tests * Chore: Add methods from sqlstore to org service interface * Avoiding import cycle * Add and remove some methods
This commit is contained in:
@@ -211,3 +211,36 @@ func (s *Service) GetOrCreate(ctx context.Context, orgName string) (int64, error
|
||||
}
|
||||
return orga.ID, nil
|
||||
}
|
||||
|
||||
// TODO: remove wrapper around sqlstore
|
||||
func (s *Service) AddOrgUser(ctx context.Context, cmd *org.AddOrgUserCommand) error {
|
||||
c := &models.AddOrgUserCommand{
|
||||
LoginOrEmail: cmd.LoginOrEmail,
|
||||
OrgId: cmd.OrgID,
|
||||
UserId: cmd.UserID,
|
||||
Role: cmd.Role,
|
||||
AllowAddingServiceAccount: cmd.AllowAddingServiceAccount,
|
||||
}
|
||||
return s.sqlStore.AddOrgUser(ctx, c)
|
||||
}
|
||||
|
||||
// TODO: remove wrapper around sqlstore
|
||||
func (s *Service) UpdateOrgUser(ctx context.Context, cmd *org.UpdateOrgUserCommand) error {
|
||||
c := &models.UpdateOrgUserCommand{
|
||||
UserId: cmd.UserID,
|
||||
OrgId: cmd.OrgID,
|
||||
Role: cmd.Role,
|
||||
}
|
||||
return s.sqlStore.UpdateOrgUser(ctx, c)
|
||||
}
|
||||
|
||||
// TODO: remove wrapper around sqlstore
|
||||
func (s *Service) RemoveOrgUser(ctx context.Context, cmd *org.RemoveOrgUserCommand) error {
|
||||
c := &models.RemoveOrgUserCommand{
|
||||
UserId: cmd.UserID,
|
||||
OrgId: cmd.OrgID,
|
||||
ShouldDeleteOrphanedUser: cmd.ShouldDeleteOrphanedUser,
|
||||
UserWasDeleted: cmd.UserWasDeleted,
|
||||
}
|
||||
return s.sqlStore.RemoveOrgUser(ctx, c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user