Files
vmall/apps/mall/nuxt.config.ts
T
james 104737e4e1 feat(mall): serve home marketing content from the API
Wave 4 of replacing the fixed-data mock adapter, and the first capability the
mall never had a backend for: the home page's banners, promo tiles, quick links
and floor advert art move out of local arrays.

- four explicit tables (`banners`, `promos`, `quick_links`, `floor_adverts`)
  rather than one JSONB payload table, so Postgres enforces each shape
- a migration seeds them from the assets the page already rendered, so the flip
  is visually a no-op. Destinations are real routes now: the mock's promo links
  pointed at dangling `?category=c1` ids and its first banner used `sort=sales`,
  which the catalog API rejects
- `GET /api/content/home` is public and returns the four active, ordered lists,
  always including a key so a page can render a missing block
- `GET /api/admin/content` and `PUT /api/admin/content/{kind}` let a platform
  admin read everything and replace one kind transactionally, with positions
  reindexed from the submitted order and a rejected list changing nothing
- the mall's fixed-data adapter learns `getHomeContent`, and a `content` domain
  joins the per-domain switch so the rollback path still renders the page

Verified: 23 backend tests green including six new content tests; all three
frontends build; the home page renders the same four blocks as before, an admin
reorder and deactivation change the rendered carousel, and the fixed-data
rollback renders every block with the backend stopped.

OpenSpec change: openspec/changes/replace-mock-api-wave-4
2026-09-17 16:48:10 +00:00

28 lines
942 B
TypeScript

export default defineNuxtConfig({
modules: ["@pinia/nuxt", "@nuxtjs/i18n"],
css: ["@vmall/shared/ui.css", "~/assets/mall.css"],
devtools: { enabled: false },
devServer: { port: 3000 },
runtimeConfig: {
public: {
apiBase: "http://localhost:8080/api",
// Domains served by the live backend; every other domain stays on the
// fixed-data adapter. Override with NUXT_PUBLIC_LIVE_DOMAINS='["catalog"]'.
// See openspec/changes/replace-mock-api-wave-1/design.md and waves 2-3.
liveDomains: ["catalog", "currency", "content", "auth", "cart", "orders", "shipments", "invoices"],
appName: "mall",
},
},
i18n: {
strategy: "no_prefix",
defaultLocale: "en",
locales: [
{ code: "en", name: "English" },
{ code: "zh", name: "中文" },
],
vueI18n: "../i18n.config.ts",
bundle: { optimizeTranslationDirective: false },
},
compatibilityDate: "2025-01-01",
});