docs(05-03): complete Portal Ticket Submission and Payment Scaffold plan

Tasks completed: 2/2
- Task 1: TicketComment model and portal ticket service
- Task 2: Portal ticket API routes, payment scaffold, and tests

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

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
kevin-asprec
2026-03-05 17:36:59 +08:00
parent 3f44f5c953
commit 82c8dc39d1
2 changed files with 132 additions and 8 deletions

View File

@@ -10,11 +10,11 @@ See: .planning/PROJECT.md (updated 2026-03-04)
## Current Position
Phase: 5 of 5 (Visibility and Client Portal)
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 API5 tests, portal credentials provider, subscriber-scoped endpoints)
Plan: 3 of 5 in phase 5 (26/28 total complete)
Status: In progress. 05-01, 05-02, and 05-03 complete.
Last activity: 2026-03-05 — Completed 05-03-PLAN.md (Portal Ticket Submission and Payment Scaffold6 tests, conversation threads, payment coming-soon endpoint)
Progress: [█████████████████████████░░] 89% (25/28 plans across all phases)
Progress: [█████████████████████████░░] 93% (26/28 plans across all phases)
## Performance Metrics
@@ -31,10 +31,10 @@ 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 | 2/5 complete | 7 min | 3.5 min |
| 05-visibility-and-client-portal | 3/5 complete | 12 min | 4 min |
**Recent Trend:**
- 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)
- Last 10 plans: 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), 05-03 (5 min)
- Trend: Phase 5 plans executing fast — service + API + tests pattern, minimal schema changes
*Updated after each plan completion*
@@ -152,6 +152,12 @@ Recent decisions affecting current work:
- [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
- [05-03]: ensurePortalUser creates shadow User with CLIENT role and portal-{accountNumber}@portal.local email — bridges Subscriber auth to User FK on Ticket.createdById
- [05-03]: Portal tickets use source=SUBSCRIBER (not PORTAL) — TicketSource enum has STAFF/SUBSCRIBER only
- [05-03]: TicketComment is append-only (no updatedAt, no edits/deletes) — conversation integrity preserved
- [05-03]: Closed tickets reject new comments — enforced at service layer in addTicketComment
- [05-03]: Payment scaffold computes outstanding balance in JS from SENT/PARTIAL/OVERDUE invoices — same derived-aggregation pattern
- [05-03]: Portal ticket cleanup order: ticketComments -> tickets -> ticketCategories -> subscribers -> servicePlans -> tenantSettings -> accountingPeriods -> accounts -> users -> tenant
### Pending Todos
@@ -169,6 +175,6 @@ None.
## Session Continuity
Last session: 2026-03-05T09:25:00Z
Stopped at: Completed 05-02-PLAN.md (Subscriber Portal Auth and API5 tests, portal credentials, subscriber-scoped endpoints).
Last session: 2026-03-05T09:35:00Z
Stopped at: Completed 05-03-PLAN.md (Portal Ticket Submission and Payment Scaffold6 tests, conversation threads, payment coming-soon endpoint).
Resume file: None