docs(05-02): complete Subscriber Portal Auth and API plan

Tasks completed: 2/2
- Portal authentication via subscriber account number
- PortalService, API routes, and integration tests (5 tests)

SUMMARY: .planning/phases/05-visibility-and-client-portal/05-02-SUMMARY.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
kevin-asprec
2026-03-05 17:28:03 +08:00
parent 7222dbeafe
commit ab1e94480e
2 changed files with 126 additions and 12 deletions

View File

@@ -10,18 +10,18 @@ See: .planning/PROJECT.md (updated 2026-03-04)
## Current Position
Phase: 5 of 5 (Visibility and Client Portal)
Plan: 1 of 5 in phase 5 (24/28 total complete)
Status: In progress. 05-01 complete (Dashboard Metrics API).
Last activity: 2026-03-05 — Completed 05-01-PLAN.md (Dashboard Metrics API — 6 tests, revenue/overdue/subscriber/cashflow/collector metrics)
Plan: 2 of 5 in phase 5 (25/28 total complete)
Status: In progress. 05-01 and 05-02 complete.
Last activity: 2026-03-05 — Completed 05-02-PLAN.md (Subscriber Portal Auth and API — 5 tests, portal credentials provider, subscriber-scoped endpoints)
Progress: [████████████████████████░░░] 86% (24/28 plans across all phases)
Progress: [████████████████████████░░░] 89% (25/28 plans across all phases)
## Performance Metrics
**Velocity:**
- Total plans completed: 17
- Average duration: 10.3 min
- Total execution time: 178 min
- Total plans completed: 18
- Average duration: 10.1 min
- Total execution time: 182 min
**By Phase:**
@@ -31,11 +31,11 @@ Progress: [███████████████████████
| 02-subscriber-and-billing-core | 5/5 complete | 57 min | 11.4 min |
| 03-operational-modules | 5/5 complete | ~65 min | ~13 min |
| 04-inventory-expenses-reports | 5/5 complete | 71 min | 14.2 min |
| 05-visibility-and-client-portal | 1/5 complete | 3 min | 3 min |
| 05-visibility-and-client-portal | 2/5 complete | 7 min | 3.5 min |
**Recent Trend:**
- Last 10 plans: 03-02 (11 min), 03-04 (6 min), 03-05 (9 min), 04-01 (16 min), 04-03 (17 min), 04-05 (10 min), 04-02 (8 min), 04-04 (20 min), 05-01 (3 min)
- Trend: 05-01 fastest plan yet — pure service + API + tests, no schema changes
- Last 10 plans: 03-04 (6 min), 03-05 (9 min), 04-01 (16 min), 04-03 (17 min), 04-05 (10 min), 04-02 (8 min), 04-04 (20 min), 05-01 (3 min), 05-02 (4 min)
- Trend: Phase 5 plans executing fast — service + API + tests pattern, minimal schema changes
*Updated after each plan completion*
@@ -147,6 +147,11 @@ Recent decisions affecting current work:
- [05-01]: Cash flow uses same approach as FinancialReportService — POSTED JE lines on revenue (4xxx) and expense (5xxx) accounts with normal balance logic
- [05-01]: getDashboardSummary runs all 5 metric methods in parallel via Promise.all
- [05-01]: Dashboard cleanup order: expenses -> vendors -> expenseCategories (custom) -> collectionAllocations -> collections -> remittances -> paymentAllocations -> payments -> invoiceLines -> invoices -> journalEntryLines -> null reversesEntryId -> journalEntries -> zoneAssignments -> subscribers -> zones -> servicePlans -> accountingPeriods -> accounts -> ticketCategories -> expenseCategories (system) -> users -> tenant
- [05-02]: Dual NextAuth credentials providers (staff id=credentials, portal id=portal-credentials) on same instance — additive, no change to staff auth
- [05-02]: Subscriber.passwordHash is nullable — only subscribers with a set password can log in to portal
- [05-02]: subscriberId persisted in JWT token and session — distinguishes portal users from staff users without DB lookup
- [05-02]: withPortalAuth HOF validates subscriberId in session; 401 if no session, 403 if not portal user
- [05-02]: Portal cleanup order: payments -> paymentAllocations -> invoiceLines -> invoices -> journalEntryLines -> null reversesEntryId -> journalEntries -> subscribers -> servicePlans -> tenantSettings -> accountingPeriods -> accounts -> users -> tenant
### Pending Todos
@@ -164,6 +169,6 @@ None.
## Session Continuity
Last session: 2026-03-05T09:23:00Z
Stopped at: Completed 05-01-PLAN.md (Dashboard Metrics API — 6 tests, all passing).
Last session: 2026-03-05T09:25:00Z
Stopped at: Completed 05-02-PLAN.md (Subscriber Portal Auth and API — 5 tests, portal credentials, subscriber-scoped endpoints).
Resume file: None