[PR #57] Admin Customer Management (Server Task 12)
- What changed: The server gained nine routes so the admin web can register, look up, edit, suspend, and reactivate customers. The customer list can also be downloaded as a CSV file.
- Decision: The detailed rules followed the plan and the choices the user made. Names and numbers are saved masked only in history and CSV, and suspending a customer signs them out of the app.
- Still unknown: What happens when several requests try to change the same phone number at once has not been checked with a test.
This post records the server feature for customer management in the admin web. The devlog numbers it as server task 12.
Models used: Claude Sonnet 5.5 wrote the implementation. A Buzz server agent wrote the tests, and its model is not known, so it is listed as unknown. Another agent did the review.
What and why
| Feature | What it does |
|---|---|
| Customer list | Search, tabs, filters by farm and role, 20 per page, and CSV download, all from one query. |
| Register, view, edit | Registers a new customer, shows details, and edits information such as the name. |
| Change phone number | Signs the customer out of every login and cancels unused invite codes. |
| Suspend and reactivate | Suspending signs the customer out of the app. Only a suspended customer can be reactivated. |
| Unlink sign-in method | Uses the same unlink service the customer app already used, to disconnect Kakao or Apple. |
| History | Writes one line per change. Names are partly hidden, and the middle of phone numbers is hidden. |
Options chosen and rejected
- The list is fetched with one query. Asking separately for each page was rejected.
- Unlinking sign-in methods was not rebuilt. The service the customer app used was registered for admin use, and its code was not changed.
- The suspension reason keeps the existing value (
suspended). A new value would make the app receive the wrong error. - Search text is handled as plain text. Search symbols are not read as search conditions.
- Values that spreadsheet software could run as formulas get a leading apostrophe in CSV. This stops them from running.
How it was checked
- Thirty-four failing tests written before the implementation by a Buzz server agent were made to pass. The test files were not changed.
- The full check (
npm run verify) passed: 21 test files and 242 tests. - The working environment’s Docker daemon was started by hand to run the database tests.
Lessons
- Before creating a new value, check whether the existing one already fits. Changing a value the app already knows breaks the other side.
- Search history hides only long number sequences, so names typed as searches are still saved as they are. That is the scope as it stands.