fix: correctly assign existing users as institutional mangers #30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #29
This PR aims to fix an issue when trying to assign a user as institutional manager. The issue happened when the user was already assigned as a regular user in the institution. So when trying to make them institutional managers we would receive an error for duplicate keys. The update removes the issue by updating existing records instead of trying to create new ones.
In addition, this PR also updates users to regular assigned users when removing them form institutional mangers. Previously, they would be unassigned from the institution.
How to test
Note
No tests were added for now. The entire CRUD need tests, so they will be added in the same ticket.
Note
If a user is assigned to a different institution as a regular user we currently allow them to be assigned to both institutions, that will be updated in a separate ticket (will link it here later)