refactor: 移除旧服务模型统一使用业务提供项

This commit is contained in:
que01 committed 2026-09-21 17:11:45 +08:00
1 parent ca85a583ce
commit 844a3bd715
13 files changed
+92 -146

No files matched your search

+6 -7
View File
@@ -19,7 +19,7 @@ async function main(): Promise<void> {
},
});
const services = [
const offerings = [
{
brandId: brand.id,
name: "红烧肉双拼套餐",
@@ -41,16 +41,15 @@ async function main(): Promise<void> {
name: "家庭聚餐私厨",
description: "根据人数、地点和口味人工沟通报价",
priceText: "面议",
bookingEnabled: true,
sortOrder: 3,
},
];
for (const service of services) {
const existing = await prisma.service.findFirst({
where: { brandId: brand.id, name: service.name },
for (const offering of offerings) {
const existing = await prisma.offering.findFirst({
where: { brandId: brand.id, name: offering.name },
});
if (existing) await prisma.service.update({ where: { id: existing.id }, data: service });
else await prisma.service.create({ data: service });
if (existing) await prisma.offering.update({ where: { id: existing.id }, data: offering });
else await prisma.offering.create({ data: { ...offering, kind: "service" } });
}
for (const name of ["普通套餐", "私厨", "配送", "自取", "熟客", "重点跟进"]) {