Skip to content

feat: add update user endpoint - #126

Open
emay2026 wants to merge 6 commits into
mate-academy:mainfrom
emay2026:feat/update-user
Open

feat: add update user endpoint#126
emay2026 wants to merge 6 commits into
mate-academy:mainfrom
emay2026:feat/update-user

Conversation

@emay2026

@emay2026 emay2026 commented Sep 2, 2026

Copy link
Copy Markdown

This PR implements the PUT /users/:id endpoint to allow updating existing users.

Changes

  • Added helper in for data mutation.
  • Implemented in with:
    • Input validation requiring and (returns 400 on failure).
    • 404 response for non-existent user IDs.
    • 200 response with updated user object on success.
  • Updated with implementation details and review findings.

Testing

Run

claude-course-starter@1.0.0 test
node --test

✔ NOTES.md exists at the project root (0.820417ms)
✔ NOTES.md has real content (0.436ms)
✔ PUT /users/:id updates an existing user (28.9385ms)
✔ PUT /users/:id returns 404 for a user that does not exist (2.637417ms)
✔ PUT /users/:id with a missing field returns 400 (2.539834ms)
✔ GET /health returns ok (16.754291ms)
✔ GET /users returns a list of users (4.866125ms)
✔ GET /users/:id returns 404 for a user that does not exist (3.02075ms)
✔ POST /users with no body returns 400 (6.367041ms)
ℹ tests 9
ℹ suites 0
ℹ pass 9
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 268.492458 to verify. Specifically, the following cases are covered:

  • Updating an existing user (200 OK)
  • Attempting to update a non-existent user (404 Not Found)
  • Sending a request with missing fields (400 Bad Request)

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Your implementation fully meets all task requirements. The PUT /users/:id endpoint correctly handles all three success paths: it returns 400 when name or email are missing, 404 when the user doesn't exist, and 200 with the updated user on success. The code properly leverages the db/store.js updateUser helper and follows existing patterns throughout. All 9 tests pass, confirming no regressions. NOTES.md contains meaningful documentation covering your approach, model choice, and review findings. This is a solid implementation—you're clear to merge.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

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.

3 participants