UserService: use the UserService instead of calling sqlstore directly (#55745)
* UserService: update callers to use the UserService instead of calling sqlstore directly There is one major change hiding in this PR. UserService.Delete originally called a number of services to delete user-related records. I moved everything except the actual call to the user table, and moved those into the API. This was done to avoid dependencies cycles; many of our services depend on the user service, so the user service itself should have as few dependencies as possible.
This commit is contained in:
@@ -13,6 +13,8 @@ type FakeUserService struct {
|
||||
ExpectedSetUsingOrgError error
|
||||
ExpectedSearchUsers user.SearchUserQueryResult
|
||||
ExpectedUSerProfileDTO user.UserProfileDTO
|
||||
|
||||
GetSignedInUserFn func(ctx context.Context, query *user.GetSignedInUserQuery) (*user.SignedInUser, error)
|
||||
}
|
||||
|
||||
func NewUserServiceFake() *FakeUserService {
|
||||
@@ -60,6 +62,9 @@ func (f *FakeUserService) GetSignedInUserWithCacheCtx(ctx context.Context, query
|
||||
}
|
||||
|
||||
func (f *FakeUserService) GetSignedInUser(ctx context.Context, query *user.GetSignedInUserQuery) (*user.SignedInUser, error) {
|
||||
if f.GetSignedInUserFn != nil {
|
||||
return f.GetSignedInUserFn(ctx, query)
|
||||
}
|
||||
if f.ExpectedSignedInUser == nil {
|
||||
return &user.SignedInUser{}, f.ExpectedError
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user