Files
vmall/openspec/changes/archive/2026-09-17-replace-mock-api-wave-6/proposal.md
T
james e457339847 chore(openspec): archive wave 6 and close the migration tracker
The merge creates the brand capability (two requirements) and extends the
catalog browse requirement with the brand filter, the sales sort and a real
sold count. openspec validate --all --strict stays green at 14 specs.

With every box now checked, docs/TBD-migrate-wave.md is deleted, as its own
instructions require. Its two durable notes move to the README instead of
disappearing with it:

- `nuxt build` does not typecheck, so a green build is not the type gate the
  verification section claimed. AGENTS.md told me to treat it as one, which is
  why waves 1-5 over-reported "builds pass" as evidence.
- the list of what stays deliberately mock: addresses, coupons, favourites,
  account stats, the seckill/collective/integral pages, reviews, and the
  fixed-data adapter itself, which the adapter spec requires for rollback.

The README's verification block also gains the real test count (29, not 16).
2026-09-17 17:36:22 +00:00

34 lines
2.1 KiB
Markdown

# Proposal
## Why
Wave 1 removed the brand facet and the sales/comments sorts because nothing backed them. Two of those three gaps now close for real: sales derive from `order_items`, and a brand model is a small table plus a product column.
## What Changes
- Add a `brands` table (bilingual name, slug) and `products.brand_id`, with a public `GET /api/brands`, a `brand_id` filter on `listProducts`, and the search page's brand facet restored.
- Manage brands with `PUT /api/admin/brands`, a transactional ordered replace like storefront content, and seed the demo products' brands.
- Add `sort=sales` to `listProducts`, computed from `order_items` over orders that reached payment, and carry a real `sold_count` on product payloads instead of the mall's hash-derived figure.
- Show that real sold count on product cards and the product detail page.
- **BREAKING** (display): remove the review UI — the card's review figure and the product detail page's reviews tab — because a reviews capability does not exist and the mall currently presents invented reviewers and ratings as fact.
- Keep the detail page's after-sale tab, which shows the shop's real copy.
## Capabilities
### New Capabilities
- `brand`: the product brand registry — a bilingual, admin-managed list that products reference and shoppers filter by.
### Modified Capabilities
- `catalog`: public listing filters by brand and can sort by real sales, and product payloads report a sold count.
- `frontend-mall`: the search page offers the brand facet and a sales sort again, and the product detail page no longer presents reviews.
## Impact
A migration and new route module; `packages/shared/src/{api,types}.ts`; `pages/search.vue`, `components/ui/ProductCard.vue`, `pages/goods/[id].vue`; `scripts/seed-demo.mjs`; the mall's fixed-data adapter. The contract change rebuilds all three frontends.
## Non-goals
No reviews capability: writing and moderating reviews is a feature, not a migration, and it is recorded as future work. No change to the seckill, collective or integral pages, nor to coupons, favourites, addresses or the cookie.