refactor: 退役运行时视觉模块并泛化模板门禁
This commit is contained in:
1 parent
25d1fe983c
commit
e2e2340bfe
56 files changed
+290
-1037
No files matched your search
@@ -0,0 +1 @@
|
||||
DROP TABLE "BrandModule";
|
||||
@@ -54,7 +54,6 @@ model BrandProfile {
|
||||
tags Tag[]
|
||||
trustContents TrustContent[]
|
||||
templateInstallations BrandTemplateInstallation[]
|
||||
modules BrandModule[]
|
||||
fieldDefinitions BrandFieldDefinition[]
|
||||
offerings Offering[]
|
||||
inquiryForms InquiryForm[]
|
||||
@@ -123,21 +122,6 @@ model BrandTemplateInstallation {
|
||||
@@index([brandId])
|
||||
}
|
||||
|
||||
model BrandModule {
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
brand BrandProfile @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||
type String
|
||||
title String
|
||||
isEnabled Boolean @default(true)
|
||||
sortOrder Int @default(0)
|
||||
source String @default("core")
|
||||
config Json?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
@@index([brandId, isEnabled, sortOrder])
|
||||
}
|
||||
|
||||
model BrandFieldDefinition {
|
||||
id String @id @default(uuid())
|
||||
brandId String
|
||||
|
||||
@@ -702,26 +702,6 @@ async function ensureRuntimeContent(brandId: string, template: RuntimeSeedTempla
|
||||
data: { isEnabled: false },
|
||||
});
|
||||
}
|
||||
const moduleDefinitions = [
|
||||
["founder-card", "主理人介绍"],
|
||||
["brand-hero", "品牌首屏"],
|
||||
["trust-proof", "信任与案例"],
|
||||
["offering-list", "业务提供项"],
|
||||
["inquiry", "咨询入口"],
|
||||
] as const;
|
||||
for (const [sortOrder, [type, title]] of moduleDefinitions.entries()) {
|
||||
const existing = await prisma.brandModule.findFirst({ where: { brandId, type } });
|
||||
if (existing) {
|
||||
await prisma.brandModule.update({
|
||||
where: { id: existing.id },
|
||||
data: { isEnabled: true, sortOrder, title },
|
||||
});
|
||||
} else {
|
||||
await prisma.brandModule.create({
|
||||
data: { brandId, type, title, sortOrder, source: "seed", isEnabled: true },
|
||||
});
|
||||
}
|
||||
}
|
||||
const incompleteOfferings = await prisma.offering.findMany({
|
||||
where: { brandId, isEnabled: true, coverUrl: null },
|
||||
select: { id: true, name: true },
|
||||
|
||||
Reference in new issue
Block a user