modified: internal/service/user_service.go
fic bag with check the user exits
This commit is contained in:
@@ -20,7 +20,6 @@ func NewUserService(userRepo *repository.UserRepository) *UserService {
|
|||||||
func (s *UserService) CreateUser(req *model.CreateUserRequest) (*model.UserResponse, error) {
|
func (s *UserService) CreateUser(req *model.CreateUserRequest) (*model.UserResponse, error) {
|
||||||
// Проверяем существует ли пользователь с таким email
|
// Проверяем существует ли пользователь с таким email
|
||||||
existingUser, err := s.userRepo.FindByEmail(req.Email)
|
existingUser, err := s.userRepo.FindByEmail(req.Email)
|
||||||
fmt.Println(existingUser, err)
|
|
||||||
if err.Error() != "record not found" {
|
if err.Error() != "record not found" {
|
||||||
return nil, errors.New("user with this email already exists")
|
return nil, errors.New("user with this email already exists")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user