File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Notes — update-user endpoint
2+
3+ ** Plan.** Add ` PUT /users/:id ` to ` routes/users.js ` plus an ` updateUser(id, { name, email }) `
4+ helper in ` db/store.js ` , mirroring the existing ` getUserById ` /` createUser ` pattern so the
5+ route stays thin and all data access goes through the store. Validate ` name ` and ` email `
6+ the same way ` POST /users ` already does (400 if either is missing), and return 404 when
7+ the id doesn't exist. The plan matched the tests in ` tests/update-user.test.js ` directly,
8+ so I approved it without edits.
9+
10+ ** Model.** Claude Sonnet 5 — this is a small, well-scoped change against a codebase whose
11+ conventions are obvious from the existing routes, so no need for a heavier model.
12+
13+ ** Commits.** Split into two: one adding ` updateUser ` to ` db/store.js ` , one adding the
14+ ` PUT /:id ` route that uses it. Each commit is a complete, reviewable unit — the store
15+ change makes sense on its own (a new data-access helper following the existing pattern),
16+ and the route change is easy to read against it without needing to hold both diffs in
17+ your head at once.
18+
19+ ** Review.** Ran a self-review (` /code-review ` ) before opening the PR. It came back clean:
20+ no removed behavior or broken call sites, ` Number(req.params.id) ` producing ` NaN ` for a
21+ non-numeric id still falls through correctly to the 404 path via ` === ` , and mutating the
22+ found user in place is consistent with how the in-memory store already works. No changes
23+ were needed.
You can’t perform that action at this time.
0 commit comments