4.2 KiB
4.2 KiB
1. Persistence and shared contract
- 1.1 Add migration
0017_product_reviews.sql(0016 is taken by membership/messaging) creatingproduct_reviewswith anorder_item_idunique index, cascading order-item/order/product/shop/customer foreign keys, arating1-5 check, bilingualcontentandreplyJSONB{en, zh}columns, optionalimage_urls, a visibilitystatuscolumn, reply audit columns, and product/status and shop listing indexes. - 1.2 Add shared
Review,ReviewInput,ReviewSummary,ReviewableOrderItem, and review query types pluslistProductReviews,getProductReviewSummary,listReviewableItems,createReview,listShopReviews,replyReview,listModerationReviews,hideReview, anddeleteReviewmethods to@vmall/shared. - 1.3 Implement
apps/api/src/modules/review/repository, service (returningApiResult<Dto>), DTO, handlers, and module registration with customer routes, merchant routes declaring roles and scoping shop resources throughown_shop, and admin routes declaring the platform role. - 1.4 Implement completed-order-line precondition checks, duplicate-review rejection backed by the unique index, a single guarded merchant reply (
UPDATE ... WHERE reply IS NULL), guarded visibility transitions (UPDATE ... WHERE status = ...), visible-only public filtering, and SQL-aggregated rating summaries (average, count, per-star counts) over visible reviews.
2. Backend behavioral proof
- 2.1 Add API integration coverage in
apps/api/tests/reusingtests/common/mod.rsfixtures for creation preconditions and unique-index enforcement, customer ownership and role checks,own_shopscoping on merchant routes, one-reply enforcement, guarded hide/delete transitions, hidden-review filtering from public lists and summaries, and rating aggregation with hidden rows excluded. - 2.2 Run the focused review integration tests twice to prove pagination totals stay correct against the shared non-truncated test database.
3. Mall review surfaces and adapter
- 3.1 Implement the nine review client methods in
apps/mall/mock/api.tswith per-session mutable fixture state and the same one-review-per-line, one-reply, and visible-only behavior as the live backend. - 3.2 Add the
reviewsdomain and exact shared-client method picks toLIVE_PICKSinapps/mall/plugins/api.tsand enable it inDEFAULT_LIVE_DOMAINS. - 3.3 Add or adjust bilingual review loading, submission, reply, and failure strings through the existing Mall locale source without per-page hard-coded copy.
- 3.4 Replace the product-detail display-only comment placeholder and the "no reviews tab" comment in
apps/mall/pages/goods/[id].vuewith the real review tab: rating summary (average, count, star distribution), paginated visible reviews with images and merchant replies, and pagination totals from the API. - 3.5 Add the buyer-center "pending review" entry and submission form: list completed order lines awaiting review with counts, submit rating, text, and optional image URLs once per line, and refresh the pending list after submission.
4. Merchant and platform consoles
- 4.1 Add a shop-admin review list/reply page scoped to the merchant's own shop with pagination and one-reply submission through the shared contract.
- 4.2 Add the admin review moderation list with hide (soft delete) and delete actions plus console navigation.
5. Verification and tracker cleanup
- 5.1 Seed a deterministic completed order with unreviewed lines, run the API plus Mall, and browser-smoke review submission from the buyer center, product-detail summary and paginated list refresh, merchant reply in shop-admin, admin hide removing the review from the storefront and its summary, and the fixed-adapter review flow.
- 5.2 Run the review integration tests in
apps/api/tests/(reusingtests/common/mod.rsfixtures) and build all three frontends because the shared contract changes:pnpm --filter @vmall/mall build,pnpm --filter @vmall/shop-admin build, andpnpm --filter @vmall/admin build. - 5.3 Mark Reviews implemented in
docs/TBD-marketing.mdand update the README mock boundary, check every OpenSpec task, and runopenspec change validate add-product-reviews --strictplusopenspec validate --all --strict.