商品模板功能上传
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { PrismaClient, ResourceBizType, ResourceMediaType, ResourceOwnerType } from '@prisma/client';
|
||||
import { DEFAULT_PRODUCT_DETAIL_TEMPLATES } from './seeds/product-detail-templates.default';
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
@@ -46,6 +47,7 @@ async function main() {
|
||||
await prisma.commonCity.deleteMany();
|
||||
await prisma.partner.deleteMany();
|
||||
await prisma.commonProductItem.deleteMany();
|
||||
await prisma.commonProductDetailTemplate.deleteMany();
|
||||
await prisma.commonStoreCategory.deleteMany();
|
||||
await prisma.commonPromoCode.deleteMany();
|
||||
await prisma.commonResource.deleteMany();
|
||||
@@ -89,6 +91,24 @@ async function main() {
|
||||
prisma.commonStoreCategory.create({ data: { code: 'LOCAL', name: '地方菜', sort: 2 } }),
|
||||
]);
|
||||
|
||||
for (const tpl of DEFAULT_PRODUCT_DETAIL_TEMPLATES) {
|
||||
await prisma.commonProductDetailTemplate.create({
|
||||
data: {
|
||||
code: tpl.code,
|
||||
name: tpl.name,
|
||||
description: tpl.description,
|
||||
aromaType: tpl.aromaType as 'QINGXIANG' | 'JIANGXIANG' | 'NONGXIANG' | null,
|
||||
storyTitle: tpl.storyTitle,
|
||||
storyText: tpl.storyText,
|
||||
features: tpl.features,
|
||||
detailImageUrls: [],
|
||||
suggestedDetailImageCount: tpl.suggestedDetailImageCount,
|
||||
sortOrder: tpl.sortOrder,
|
||||
status: 'ACTIVE',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const productDefs = [
|
||||
{ skuCode: 'QX-001', name: '杜康·白水古酿 500ml', subtitle: '清香型 52度 礼盒装', price: 599, sortOrder: 1, img: 'https://picsum.photos/seed/dukang1/400/400' },
|
||||
{ skuCode: 'QX-002', name: '杜康·年份陈酿(十年)', subtitle: '清香型 42度 纯粮酿造', price: 880, sortOrder: 2, img: 'https://picsum.photos/seed/dukang2/400/400' },
|
||||
@@ -227,6 +247,7 @@ async function main() {
|
||||
|
||||
console.log('Seed complete:', {
|
||||
city: city.name,
|
||||
detailTemplates: DEFAULT_PRODUCT_DETAIL_TEMPLATES.length,
|
||||
products: products.length,
|
||||
stores: storeDefs.length,
|
||||
testPhones: {
|
||||
|
||||
Reference in New Issue
Block a user