1.3 KiB
1.3 KiB
Implementer — F-021 Orders module
Summary
Implemented orders module with item snapshots, explicit state machine, ownership-scoped reads, and domain event publishing for OrderCreated, OrderPaid and OrderCancelled.
Files changed
project/migrations/016_orders.jsproject/src/modules/orders/**project/src/app/build-app.tsproject/src/app/tests/orders.itest.ts
Acceptance evidence
- AC1 snapshot survives:
orders.itest.tsGET/orders/:idreturns name/sku/price/tax/discount exactly as provided at create time. - AC2 illegal transition rejected: SHIPPED -> PENDING returns 409 ORDER_STATE_TRANSITION_INVALID.
- AC3 state machine:
order-state-machine.test.tscovers happy path and terminal states;order-service.test.tscovers creation event emission and rejected transitions. - AC4 OrderCreated emitted:
order-service.test.tscaptures the event.
Commands run
cd project && npm run lint/typecheck/build/testpassedcd project && TEST_DATABASE_URL='postgres://mdv:mdv_dev_only@localhost:5432/mdv_test' npm run test:integration -- orders.itestpassed; 13 files, 50 tests./scripts/verify.shpassed
Notes
- No new runtime dependency.
- Refunds and admin UI intentionally deferred to F-023+.
- Event publisher is no-op for v1; F-024 will provide an implementation.