Skip to content

Commit

Permalink
refactor: rename user service
Browse files Browse the repository at this point in the history
  • Loading branch information
stonith404 committed Aug 28, 2024
1 parent 2b9413c commit 8e27320
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (s *UserService) DeleteUser(userID string) error {
}

func (s *UserService) CreateUser(input dto.UserCreateDto) (model.User, error) {
user := &model.User{
user := model.User{
FirstName: input.FirstName,
LastName: input.LastName,
Email: input.Email,
Expand All @@ -57,11 +57,11 @@ func (s *UserService) CreateUser(input dto.UserCreateDto) (model.User, error) {
}
if err := s.db.Create(user).Error; err != nil {
if errors.Is(err, gorm.ErrDuplicatedKey) {
return model.User{}, s.checkDuplicatedFields(*user)
return model.User{}, s.checkDuplicatedFields(user)
}
return model.User{}, err
}
return *user, nil
return user, nil
}

func (s *UserService) UpdateUser(userID string, updatedUser dto.UserCreateDto, updateOwnUser bool) (model.User, error) {
Expand Down

0 comments on commit 8e27320

Please sign in to comment.