-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add user profile update #1
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
base: taskaza-agent
Are you sure you want to change the base?
feat: add user profile update #1
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
| data = update.model_dump(exclude_unset=True) | ||
| if "username" in data: | ||
| existing = await crud_user.get_user_by_username(db, data["username"]) | ||
| if existing and existing.id != current_user.id: | ||
| raise HTTPException( | ||
| status_code=status.HTTP_400_BAD_REQUEST, detail="Username already taken" | ||
| ) | ||
| if "email" in data: | ||
| existing = await crud_user.get_user_by_email(db, data["email"]) | ||
| if existing and existing.id != current_user.id: | ||
| raise HTTPException( | ||
| status_code=status.HTTP_400_BAD_REQUEST, detail="Email already taken" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Skip email uniqueness check when clearing address
Both update_me and patch_me run a uniqueness check whenever the payload contains an email key, even when the value is null. Because get_user_by_email is then called with None, the query matches the first user that already has a NULL email (which is common because signups default to no email). The existing.id != current_user.id branch fires and returns 400 "Email already taken", making it impossible for a user to remove their email address while any other user also lacks one. The check should only run when a non-NULL email is supplied.
Useful? React with 👍 / 👎.
Summary
Testing
python3 -m pytesthttps://chatgpt.com/codex/tasks/task_e_68b10740b9508329b82d205529f92a63