-
Notifications
You must be signed in to change notification settings - Fork 64
Description
Objective: Decouple the monolithic transaction creation/update logic into a multi-stage pipeline with status tracking (Pending, Processing, Validated, Archived).
Files Involved (~8):
routes/transactions.js
: Update API logic to handle asynchronous status.
services/transactionService.js
: Core "juggling" to split logic into pre-save and post-save hooks.
models/Transaction.js
: Schema expansion for state management and processing logs.
services/ruleEngine.js
: Refactor to operate as a middleware in the processing pipeline.
services/revaluationService.js
: Update to ignore "unvalidated" transactions for net worth snapshots.
middleware/transactionValidator.js: (New) Move validation logic out of routes.
services/eventDispatcher.js: (New) Handle cross-cutting impact (Budget updates, Goal tracking).
scripts/transactionMigration.js: (New) Heavy migration script for existing data.
Code Volume: High. Requires moving existing logic across 4 new/refactored services and adding extensive error handling/status mapping.