Skip to content

Add PUT /users/:id endpoint - #20

Open
BigGregory wants to merge 4 commits into
mate-academy:mainfrom
BigGregory:add-update-user-endpoint
Open

Add PUT /users/:id endpoint#20
BigGregory wants to merge 4 commits into
mate-academy:mainfrom
BigGregory:add-update-user-endpoint

Conversation

@BigGregory

Copy link
Copy Markdown

Summary

  • Adds PUT /users/:id to update an existing user, validating that name and email are present (400 if not)
  • Returns 404 when the id doesn't match any user, instead of crashing
  • Goes through a new updateUser helper in db/store.js, following the existing store pattern

Test plan

  • npm test passes, including the provided tests/update-user.test.js (update, 404, 400 cases)
  • Self-reviewed the not-found path: a non-numeric id (Number("abc")NaN) correctly falls through to 404 via strict equality in getUserById, no crash
  • Manually try PUT /users/:id with a valid id, a missing id, and a missing field

🤖 Generated with Claude Code

Hryhorii Tereshchenko and others added 4 commits July 5, 2026 12:04
Updates an existing user by id, validating name/email like the
existing POST route and returning 404 when the id doesn't match
any user, following the same pattern as the other routes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Guidance for Claude Code on commands and the server/routes/store
architecture in this repo.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Write-up of the plan, model choice, commit split, and review for
the update-user endpoint change.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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