full-stack-fastapi-template
full-stack-fastapi-template copied to clipboard
update_user_me with another user's email not checked at backend
update_user_me endpoint function doesn't have a check if a user tries to update self email to another user's email. Database handles this correctly (by unique email constraint), but the service overall returns Error 500.
Trace:
sqlalchemy.exc.IntegrityError: (psycopg2.errors.UniqueViolation) duplicate key value violates unique constraint "ix_user_email"
DETAIL: Key (email)=([email protected]) already exists.
Fix: check if another user with same as updating email exists in the system.