phase 8: site-access and admin simplified and compacted
This commit is contained in:
48
docs/api-phase7-move-log.md
Normal file
48
docs/api-phase7-move-log.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# API Phase 7 Move Log
|
||||
|
||||
Date: 2026-03-17
|
||||
Scope: Move dashboard read endpoints out of `api/src/server.ts` into a dedicated route module.
|
||||
|
||||
## Route Registration Changes
|
||||
- Added dashboard route import in [server.ts](/mnt/c/Users/jholt/clone-test/SkyMoney/api/src/server.ts:24)
|
||||
- Registered dashboard routes in [server.ts](/mnt/c/Users/jholt/clone-test/SkyMoney/api/src/server.ts:944)
|
||||
- New canonical route module: [dashboard.ts](/mnt/c/Users/jholt/clone-test/SkyMoney/api/src/routes/dashboard.ts:24)
|
||||
- Removed inline dashboard route blocks from `server.ts` to avoid duplicate registration:
|
||||
- `GET /dashboard`
|
||||
- `GET /crisis-status`
|
||||
|
||||
## Endpoint Movements
|
||||
|
||||
1. `GET /dashboard`
|
||||
- Original: `server.ts` line 1081
|
||||
- Moved to [dashboard.ts](/mnt/c/Users/jholt/clone-test/SkyMoney/api/src/routes/dashboard.ts:24)
|
||||
- References:
|
||||
- [useDashboard.ts](/mnt/c/Users/jholt/clone-test/SkyMoney/web/src/hooks/useDashboard.ts:85)
|
||||
- [OnboardingPage.tsx](/mnt/c/Users/jholt/clone-test/SkyMoney/web/src/pages/OnboardingPage.tsx:172)
|
||||
- [auth.routes.test.ts](/mnt/c/Users/jholt/clone-test/SkyMoney/api/tests/auth.routes.test.ts:37)
|
||||
- [security-logging-monitoring-failures.test.ts](/mnt/c/Users/jholt/clone-test/SkyMoney/api/tests/security-logging-monitoring-failures.test.ts:48)
|
||||
|
||||
2. `GET /crisis-status`
|
||||
- Original: `server.ts` line 1330
|
||||
- Moved to [dashboard.ts](/mnt/c/Users/jholt/clone-test/SkyMoney/api/src/routes/dashboard.ts:273)
|
||||
- References:
|
||||
- No direct web/api wrapper references currently found via repo search.
|
||||
- Endpoint remains available for API consumers and future UI wiring.
|
||||
|
||||
## Helper Ownership in Phase 7
|
||||
- Route-local helpers in `dashboard.ts`:
|
||||
- `monthKey`
|
||||
- `monthLabel`
|
||||
- `buildMonthBuckets`
|
||||
- `DAY_MS`
|
||||
- Reused allocator date helpers:
|
||||
- static `getUserMidnightFromDateOnly`
|
||||
- dynamic import of `getUserMidnight` and `calculateNextPayday` for parity with pre-move logic
|
||||
|
||||
## Verification
|
||||
1. Build
|
||||
- `cd api && npm run build` ✅
|
||||
|
||||
2. Focused tests
|
||||
- `cd api && npm run test -- tests/auth.routes.test.ts`
|
||||
- Result: blocked by local DB connectivity (`127.0.0.1:5432` unavailable), suite skipped/failed before endpoint assertions.
|
||||
Reference in New Issue
Block a user