Assist_Design/CODEBASE_ANALYSIS.md

19 lines
2.2 KiB
Markdown
Raw Normal View History

# Codebase Analysis (October 2025)
## ✅ Recent Cleanup
- **Checkout contracts unified**: `checkoutBuildCartRequestSchema` and the wrapped response now live in `@customer-portal/domain/orders`. Both the NestJS controller and service import the shared types, eliminating local Zod definitions and ad-hoc request shapes.
- **SIM configuration aligned**: The catalog store and `useSimConfigure` hook persist state that maps directly to `simConfigureFormSchema`. Validation now delegates to the domain schema, and UI state uses the shared field names (`selectedAddons`, `scheduledActivationDate`, etc.).
- **Dashboard metadata centralized**: Invoice/service activity metadata schemas moved into `@customer-portal/domain/dashboard`, and the portal utilities reuse them rather than maintaining local copies.
- **UI totals reuse domain types**: `EnhancedOrderSummary` now aliases `CheckoutTotals`, keeping the presentation layer in lockstep with the API contract.
- **Build artefacts removed**: Legacy `dist/` folders under `apps/bff` and `packages/*` were deleted and remain ignored so future builds stay out of version control.
## 🔍 Follow-Up Opportunities
- **Auth workflow audit**: Re-run a focused review of the WHMCS link workflow and mapping services to confirm no lingering loose types (the earlier report flagged placeholder values—verify after the latest merges).
- **Portal checkout transforms**: Consider using `simConfigureFormToRequest` when serialising SIM selections into cart params so the client sends the same payload shape the BFF expects.
- **End-to-end validation run**: Execute `pnpm lint && pnpm type-check` once the workspace stabilises to catch any regressions introduced outside the touched files.
## 🎯 Next Recommended Steps
1. **Type-check sweep** run the workspace type checker and fix residual errors, paying special attention to auth and user modules.
2. **Checkout flow trace** ensure the BFF and portal both serialise/deserialise SIM selections via the shared helpers (avoids stale query-param parsing edge cases).
3. **Documentation refresh** propagate the new ownership model (domain-first schemas) into any onboarding or architecture docs so future engineers default to the shared packages.