Skip to content

Add PUT /users/:id update endpoint - #90

Open
MarinaKramarchuk wants to merge 3 commits into
mate-academy:mainfrom
MarinaKramarchuk:feature/update-user-endpoint
Open

Add PUT /users/:id update endpoint#90
MarinaKramarchuk wants to merge 3 commits into
mate-academy:mainfrom
MarinaKramarchuk:feature/update-user-endpoint

Conversation

@MarinaKramarchuk

Copy link
Copy Markdown

Summary

  • Add updateUser(id, { name, email }) to db/store.js, following the existing getUserById/createUser pattern.
  • Add PUT /users/:id to routes/users.js: validates name/email the same way POST /users does (400 on missing field), returns 404 for an unknown id, 200 with the updated user otherwise.
  • Add NOTES.md covering the plan, model choice, commit split, and self-review.

Why

Ships the "update a user" endpoint required by the course project, following the codebase's existing route/store conventions.

Test plan

  • npm test — all 9 tests pass, including the three grading tests in tests/update-user.test.js (200 update, 404 for unknown id, 400 for missing field) and the two NOTES.md checks.
  • npm run lint — clean.
  • Self-review via /code-review — no findings.

🤖 Generated with Claude Code

Follows the existing pattern (getUserById/createUser) so route
handlers stay thin and data access lives in one place.
Validates name and email the same way POST does, returns 404 when
the id doesn't exist, and 200 with the updated user otherwise.
Plan, model choice, commit split, and self-review findings for the
update-user endpoint.
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