feat: add api foundation and booking schema
This commit is contained in:
59
apps/api/prisma/seed.ts
Normal file
59
apps/api/prisma/seed.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main(): Promise<void> {
|
||||
const brand = await prisma.brandProfile.upsert({
|
||||
where: { id: "00000000-0000-0000-0000-000000000001" },
|
||||
update: {},
|
||||
create: {
|
||||
id: "00000000-0000-0000-0000-000000000001",
|
||||
name: "阿成家常菜",
|
||||
tagline: "现做家常套餐,也为小型聚餐定制一桌热饭菜",
|
||||
description: "每天认真做好一顿家常饭。",
|
||||
hours: "周一至周六 10:30-20:00",
|
||||
address: "大学城生活区东门附近",
|
||||
deliveryNote: "目前支持部分学生宿舍楼配送,无法送达时会主动联系。",
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.service.createMany({
|
||||
data: [
|
||||
{
|
||||
brandId: brand.id,
|
||||
name: "红烧肉双拼套餐",
|
||||
description: "红烧肉、时蔬、米饭",
|
||||
priceText: "¥28 / 份",
|
||||
priceAmount: 2800,
|
||||
sortOrder: 1,
|
||||
},
|
||||
{
|
||||
brandId: brand.id,
|
||||
name: "小炒鸡套餐",
|
||||
description: "现炒鸡块、时蔬、米饭",
|
||||
priceText: "¥25 / 份",
|
||||
priceAmount: 2500,
|
||||
sortOrder: 2,
|
||||
},
|
||||
{
|
||||
brandId: brand.id,
|
||||
name: "家庭聚餐私厨",
|
||||
description: "根据人数、地点和口味人工沟通报价",
|
||||
priceText: "面议",
|
||||
bookingEnabled: true,
|
||||
sortOrder: 3,
|
||||
},
|
||||
],
|
||||
skipDuplicates: true,
|
||||
});
|
||||
|
||||
for (const name of ["普通套餐", "私厨", "配送", "自取", "熟客", "重点跟进"]) {
|
||||
await prisma.tag.upsert({
|
||||
where: { brandId_name: { brandId: brand.id, name } },
|
||||
update: {},
|
||||
create: { brandId: brand.id, name, isPreset: true },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
main().finally(() => prisma.$disconnect());
|
||||
Reference in New Issue
Block a user