refac: stale test entries, failing web tests, Postgre backup bug, Hardcoded MySQL table count, Stale Postgre connection in test, own-scope visibility filter, GetAll ignoring its error, JSON tags in use-case types, 31 copies of DESKTOP_QUERY, ProfileView endpoint paths
This commit is contained in:
1 parent
efecdee200
commit
5d6f378fce
87 files changed
+696
-373
No files matched your search
@@ -53,7 +53,11 @@ func (g *CreateUserUseCase) CreateUser(ctx context.Context, createUser CreateUse
|
||||
}
|
||||
|
||||
func (g *CreateUserUseCase) create(createUser CreateUserCommand) (user.User, error) {
|
||||
if g.registrationClosed() {
|
||||
closed, err := g.registrationClosed()
|
||||
if err != nil {
|
||||
return user.User{}, err
|
||||
}
|
||||
if closed {
|
||||
return user.User{}, user.ErrRegistrationClosed
|
||||
}
|
||||
|
||||
@@ -108,15 +112,20 @@ func (g *CreateUserUseCase) create(createUser CreateUserCommand) (user.User, err
|
||||
return createdUser, nil
|
||||
}
|
||||
|
||||
func (g *CreateUserUseCase) IsRegistrationOpen() bool {
|
||||
return !g.registrationClosed()
|
||||
func (g *CreateUserUseCase) IsRegistrationOpen() (bool, error) {
|
||||
closed, err := g.registrationClosed()
|
||||
return !closed, err
|
||||
}
|
||||
|
||||
func (g *CreateUserUseCase) registrationClosed() bool {
|
||||
for _, existingUser := range g.userRepository.GetAll() {
|
||||
func (g *CreateUserUseCase) registrationClosed() (bool, error) {
|
||||
users, err := g.userRepository.GetAll()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
for _, existingUser := range users {
|
||||
if existingUser.IsVerified {
|
||||
return true
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
return false
|
||||
return false, nil
|
||||
}
|
||||
Reference in new issue
Block a user