1.6 KiB
1.6 KiB
Implementer — F-018 Cart module
Summary
Implemented authenticated cart persistence that stores only product id, variant id and quantity, and recalculates totals/availability through injected PricingService and InventoryService on every read.
Files changed
project/migrations/013_cart.jsproject/src/app/build-app.tsproject/src/app/tests/cart.itest.tsproject/src/modules/cart/**project/src/modules/inventory/index.tsproject/src/modules/pricing/index.ts
Acceptance evidence
- AC1 price changed after add:
cart.itest.tsadds item at one price, changes server price, thenGET /cartreturns recalculated totals. - AC2 out of stock:
cart.itest.tssets stock to zero and verifies cart item is flagged unavailable. - AC3 client price ignored:
cart.itest.tssends bogus price fields; response uses server-side pricing andcart_itemshas no price/tax/stock columns. verify.sh: passed.
Commands run
cd project && npm run lint— passedcd project && npm run typecheck— passedcd project && npm run build— passedcd project && npm test— passed; DB tests skipped withoutTEST_DATABASE_URLcd project && TEST_DATABASE_URL='postgres://mdv:mdv_dev_only@localhost:5432/mdv_test' npm run test:integration -- cart.itest migrations.itest— passed; 10 files, 42 tests./scripts/verify.sh— passed
Notes
- Cart routes require authentication; no guest cart persistence in this slice.
- Cart imports only public pricing/inventory interfaces, not internals.
- Added public service factories in inventory/pricing module indexes for composition-root injection.