Add update user endpoint v2 - #113
Closed
sinkobela wants to merge 9 commits into
Closed
Conversation
Adds an updateUser(id, { name, email }) function to the in-memory
store, following the existing getUserById/createUser pattern. Returns
undefined when the id doesn't match any user, so callers can decide
how to respond (used for the 404 case in the update endpoint).
Adds an update-user route: validates that name and email are present (400 otherwise), looks up the user via the store, and returns 404 if it doesn't exist. Returns the updated user with 200 on success. Validation mirrors the existing POST /users pattern for consistency.
Explains the approved plan, model choice, why the commits are split the way they are, and what self-review confirmed before opening the PR.
Add update-user endpoint (PUT /users/:id)
Adds an updateUser(id, { name, email }) function to the in-memory
store, following the existing getUserById/createUser pattern. Returns
undefined when the id doesn't match any user, so callers can decide
how to respond (used for the 404 case in the update endpoint).
Adds an update-user route: validates that name and email are present (400 otherwise), looks up the user via the store, and returns 404 if it doesn't exist. Returns the updated user with 200 on success. Validation mirrors the existing POST /users pattern for consistency.
Explains the approved plan, model choice, why the commits are split the way they are, and what self-review confirmed before opening the PR.
Empty commit to trigger the CI workflow now that GitHub Actions has been enabled on this fork (it was disabled by default and never ran on any prior push or PR).
mateacademy-ai-mentor
approved these changes
Aug 28, 2026
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
All three files implement the required functionality correctly. The PUT /users/:id endpoint in routes/users.js validates name and email presence (400), checks user existence via db/store.js (404), and returns the updated user on success (200). The updateUser helper in db/store.js correctly returns undefined for non-existent ids, following the existing store pattern. The validation-before-existence-check ordering is correct and intentional. No critical issues were found — the implementation is complete and meets all stated requirements.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.