Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use upsert() on user creation #1304

Merged
merged 2 commits into from
Feb 26, 2024
Merged

Conversation

bcb37
Copy link
Collaborator

@bcb37 bcb37 commented Feb 12, 2024

  • replaces save() with upsert() when creating/editing users from the 'init' endpoint
  • fix the response object of 'init' so it always returns the current user data structure (id, group, workingGroup)

logger.info({ message: 'Create a new User. Metadata of the user =>', details: users });
// insert or update in the database
return this.userRepository.save(users);
return this.userRepository.upsert(users, ['id']);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both the syntax save and upsert are the same in this case. Right?

@bcb37 bcb37 merged commit bd01f98 into dev Feb 26, 2024
8 checks passed
@bcb37 bcb37 deleted the bugfix/use-typeorm-upsert-issue1044 branch February 26, 2024 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: duplicate key value violates unique constraint "PK_bb6db004eeb82db68de9225e877 (/init)
3 participants