The merge creates the storefront-content capability (two requirements, five scenarios) and updates the mall's home-page requirement so its banner, promotion, quick-link and floor advert content comes from the content API. openspec validate --all --strict stays green at 12 passed / 0 failed.
32 lines
2.0 KiB
Markdown
32 lines
2.0 KiB
Markdown
# Proposal
|
|
|
|
## Why
|
|
|
|
Every domain that had an API is now live, but the home page still renders from `~/mock/data`: the carousel, promotion tiles, quick-link strip and floor advert art are local arrays. They are the last thing between the storefront and backend-driven content, and nobody can change them without a deploy.
|
|
|
|
## What Changes
|
|
|
|
- Add four content kinds behind one public read: `GET /api/content/home` returns banners, promos, quick links and floor advert art, ordered and active-only.
|
|
- Store them in typed tables rather than one JSONB blob, so the database enforces each shape.
|
|
- Seed them from the assets the page already uses (`banner-1..3`, `promo-1..3`, `floor-adv-1..6`), so the home page looks unchanged while becoming data-driven.
|
|
- Manage them with a small admin surface: `GET /api/admin/content` plus `PUT /api/admin/content/{kind}`, replacing one ordered list transactionally. Ordering falls out of array order, and four lists do not need twelve endpoints.
|
|
- Point `pages/index.vue` at the content API and delete the three mock arrays. The quick-link glyph stays in the row: it is a short SVG path, so a new link renders without a frontend deploy.
|
|
|
|
## Capabilities
|
|
|
|
### New Capabilities
|
|
|
|
- `storefront-content`: the storefront's editable marketing content — home banners, promotion tiles, quick links and floor advert art — read publicly and written by platform admins.
|
|
|
|
### Modified Capabilities
|
|
|
|
- `frontend-mall`: the home page sources its banner, promotion, quick-link and floor advert content from the content API instead of local constants.
|
|
|
|
## Impact
|
|
|
|
A new migration and `apps/api/src/routes/` module; `packages/shared/src/{api,types}.ts`; `apps/mall/pages/index.vue`. The shared contract change means all three frontends rebuild.
|
|
|
|
## Non-goals
|
|
|
|
No image upload: rows reference URLs, seeded with the existing `/mock/*.svg` assets. No content for the seckill, collective or integral pages, and none for stores, brands, coupons, favourites or addresses — each stays mock until its own wave. No scheduling, A/B testing or translated artwork.
|