1.2 KiB
1.2 KiB
Implementer — F-025 Reviews module
Summary
Implemented reviews module with verified-purchase guard (order item must be DELIVERED and owned by user), unique constraint per order item, moderation by admin, and aggregate per product.
Files changed
project/migrations/019_reviews.jsproject/src/modules/reviews/**project/src/app/build-app.ts
Acceptance evidence
- AC1 ineligible user -> 403:
reviews-service.test.tsrejects withReviewNotEligibleErrorwhen verifier returns false. - AC2 duplicate review -> 409: existing review or repository race returns
DuplicateReviewError; UNIQUE constraint at DB level enforces. - AC3 only published reviews appear:
listPublishedByProductfilters by status='published'.
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 -- migrations.itestpassed; 14 files, 53 tests./scripts/verify.shpassed
Notes
- No new runtime dependency.
- Aggregates are computed live from
reviews_reviews; cached aggregates can be added later without changing the public contract.