navigation
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
package user
|
||||
|
||||
import "trankilou.fr/lassistanoque/backend/internal/domain"
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"trankilou.fr/lassistanoque/backend/internal/domain"
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
repo domain.UserRepository
|
||||
@@ -13,5 +17,12 @@ func NewService(repo domain.UserRepository) *Service {
|
||||
}
|
||||
|
||||
func (s *Service) GetUser(id string) (*domain.User, error) {
|
||||
return s.repo.FindUser(id)
|
||||
user, err := s.repo.FindUser(id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !user.Enabled {
|
||||
return nil, fmt.Errorf("unauthorized")
|
||||
}
|
||||
return user, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user