Templates belong to a shop; claiming copies their terms into a customer-owned snapshot so a later edit or disable cannot rewrite a held coupon. Claim stock is taken with a guarded decrement after locking the template, and a unique (user, template) index makes a duplicate claim a 409. Deleting a template leaves claimed snapshots standing via ON DELETE SET NULL. Checkout accepts at most one owned coupon per generated shop order, locks the selected coupons by primary key after the SKU locks, and resolves eligibility and the discount server-side (ownership, shop, status, window, converted threshold). The realized discount and coupon id land on the order, and a pending-payment cancellation restores the coupon in the same transaction as stock. The shared contract gains the coupon types, claim/list/manage methods, and the checkout coupon map; the fixed-data adapter implements the same surface. Surfaces (shop-admin management, mall coupon pages, checkout selection) and seeding still follow in tasks 3.1-4.2.
28 lines
996 B
TypeScript
28 lines
996 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", "shops", "brands", "auth", "account", "cart", "orders", "shipments", "invoices", "addresses", "coupons"],
|
|
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",
|
|
});
|