Add PUT /users/:id endpoint to update a user - #129
Conversation
Mirrors createUser/getUserById: finds a user by id and updates its name/email in place, returning null when the id doesn't exist so callers can return a 404. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BZKasjkVMDbaS9zPBFz41Z
Validates that name and email are both present (400 if not), then updates via the store, returning 404 when the id doesn't exist. Follows the same validate-then-lookup order as the existing routes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BZKasjkVMDbaS9zPBFz41Z
Covers the approved plan, model choice, commit split, and what the code review caught. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BZKasjkVMDbaS9zPBFz41Z
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation is functionally complete and correct — all 7 API tests pass, including the PUT /users/:id endpoint with validation and 404 handling. However, you're missing a required NOTES.md file at the project root, which is part of the task definition of done. The tests NOTES.md exists at the project root and NOTES.md has real content are failing. Please create this file containing your plan, model choice, commit split organization, and any review findings or notes about the implementation.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: NCM]
If the issue is within your control, please address it.
The next review attempt will automatically launch in about 1 hour.
If you believe this is an error or need assistance, please contact the support team.
The prior AI review flagged NOTES.md as missing while attributing the finding to commit b1885d5, which is the commit that added it. This empty commit exists only to give the reviewer a new HEAD to re-check. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BZKasjkVMDbaS9zPBFz41Z
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: NCM]
If the issue is within your control, please address it.
The next review attempt will automatically launch in about 1 hour.
If you believe this is an error or need assistance, please contact the support team.
|
NOTES.md is present. Check yuliyarudzko@b1885d5 |
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: NCM]
If the issue is within your control, please address it.
The next review attempt will automatically launch in about 1 hour.
If you believe this is an error or need assistance, please contact the support team.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: NCM]
If the issue is within your control, please address it.
The next review attempt will automatically launch in about 1 hour.
If you believe this is an error or need assistance, please contact the support team.
Summary
updateUser(id, { name, email })todb/store.js, mirroring the existingcreateUser/getUserByIdstyle: finds a user by id and updates it in place, returningnullif not found.PUT /users/:idtoroutes/users.js: validates that bothnameandemailare present (400 if not), then updates via the store, returning 404 when the id doesn't exist.Why
Adds the "update a user" capability to the users resource, following the same validate-then-lookup pattern already used by
GET /users/:idandPOST /users.Test plan
npm test— all 9 tests pass, including the threetests/update-user.test.jscases (200 update, 404 not-found, 400 missing field)npm run lint— no issuesPUT /users/1with a full body → 200 with updated fields;PUT /users/9999→ 404;PUT /users/1with onlyname→ 400🤖 Generated with Claude Code
https://claude.ai/code/session_01BZKasjkVMDbaS9zPBFz41Z