[PR #69·#71] Withdrawal Server Paths
- What changed: Built server paths for withdrawal processing, the admin summary, the full history, device management, and withdrawal contact numbers. Before starting, the decision record and work instructions were posted as documents only (PR #69).
- Decision: The “A” scope was approved first, split out of work 15. The owner decided this.
- Still unknown: The holiday table used to count business days was not checked against an official notice.
What we did and why
When the work started, PR #69 posted the decision log and the work instructions as documents only. The owner added the search-cut function test to this work’s scope. The tests needed the function name and location first, so the function was placed in one file, cutSearchText. Before implementation, the same cut logic was written in two places, and this single function was meant to replace both. The document notes that this choice is easy to reverse.
Claude put withdrawal processing and admin features into the server.
- Migration: Added a column for the contact-number choice to withdrawal requests and a table that stores contact numbers separately. Removed one identity-check value that will not be used.
- Withdrawal processing: Disconnects the Kakao and Apple links first. If either one fails, it reports which side failed and stops. If both succeed, one transaction hides the name, clears the number, deletes sign-in methods, ends sessions, cancels unit assignments, records the processing time, and writes the history.
- Contact numbers: If the customer chose a phone contact, the number is stored separately in the same transaction. It is deleted three business days after processing. A job runs every hour to delete expired numbers.
- Recovery tool: A command that, after a backup is restored, hides again the withdrawals processed after a given time. Running it several times gives the same result.
- Admin features: An admin summary, a full history with search, filters, and CSV export, and a list of signed-in devices with ways to end sessions.
- Unique-value conflicts: Checks which constraint was violated, and answers “number already in use” only for the phone-number constraint.
Approaches chosen and rejected
| Decision | Chosen | Rejected, and why |
|---|---|---|
| Scheduled deletion | A timer inside the server, once an hour | Not adding a scheduling package |
| Business-day count | Holidays for 2026 and 2027 written in code; years without a list count only weekends | An external calendar service, since it would send requests outside |
| Processing text in the CSV | A Korean label for each history type | English type names, which operators find hard to read |
| Disconnecting external links | Try both, then return the list of failures together | Stopping at the first failure, which hides whether the other side also failed |
| Recovery tool processing | Shares the same function as withdrawal processing | Separate code, which risks the two drifting apart |
How we checked
- Started the Docker daemon directly and ran the full check (
npm run verify). Type checks and lint were included, and all 369 tests passed. - The migration was generated by a tool, then the class name and value-change statements were edited by hand.
- The test file written earlier was not changed. Package files and CI settings were not touched. Only one line was added for the recovery command.
Lessons
- If two places (processing and recovery) each keep their own copy of the same logic, they drift apart over time. One shared function is safer.
- When one step calls two outside services, report which one failed, so a person can decide the next step.
- Values that change over time, such as holidays, need their source and date written next to them so they can be checked later.
- Scheduled jobs do not run right after the server starts. In an environment that restarts often, the jobs can fall behind, and that should be known in advance.