Skip to content

Conversation

toramanomer
Copy link

@toramanomer toramanomer commented May 9, 2025

What kind of change does this PR introduce?

It changes how the system handles duplicate email updates for the PUT /admin/users/{user_id} endpoint.

What is the current behavior?

Currently, updating a user by sending a PUT request to /admin/users/{user_id} endpoint with an email that already exists returns 500 Internal Server error due to an unhandled database constraint validation.

Moreover, the database operation is unnecessarily carried out even if the provided email is same as the user's current email address.

What is the new behavior?

  1. The API now returns a 422 Unprocessable Entity with a clear validation error when attempting to update a user with a duplicate email.
  2. The API does not carry out a database operation if the provided email is same as the user's current email address. The same is done for phone updates.

@toramanomer toramanomer requested a review from a team as a code owner May 9, 2025 16:13
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.

1 participant