refactor: 清理小程序静态行业数据引用

This commit is contained in:
que01 committed 2026-09-23 01:59:46 +08:00
1 parent 947e6d1ac3
commit bfa24d48d0
4 files changed
+145 -39

No files matched your search

+38 -25
View File
@@ -148,31 +148,43 @@ export class PublicWorkspaceController {
@Get()
async get(): Promise<unknown> {
const brandId = process.env.DEFAULT_BRAND_ID ?? "00000000-0000-0000-0000-000000000001";
const [brand, modules, fields, offerings, inquiryForm, installation, capabilityInstallations] =
await Promise.all([
this.prisma.brandProfile.findUnique({ where: { id: brandId } }),
this.prisma.brandModule.findMany({
where: { brandId, isEnabled: true },
orderBy: { sortOrder: "asc" },
}),
this.prisma.brandFieldDefinition.findMany({
where: { brandId, isVisible: true },
orderBy: { sortOrder: "asc" },
}),
this.prisma.offering.findMany({
where: { brandId, isEnabled: true },
orderBy: { sortOrder: "asc" },
}),
this.prisma.inquiryForm.findFirst({
where: { brandId, isEnabled: true },
orderBy: { updatedAt: "desc" },
}),
this.prisma.brandTemplateInstallation.findFirst({
where: { brandId },
orderBy: { updatedAt: "desc" },
}),
this.prisma.capabilityInstallation.findMany({ where: { brandId } }),
]);
const [
brand,
modules,
fields,
offerings,
inquiryForm,
installation,
capabilityInstallations,
trustContents,
] = await Promise.all([
this.prisma.brandProfile.findUnique({ where: { id: brandId } }),
this.prisma.brandModule.findMany({
where: { brandId, isEnabled: true },
orderBy: { sortOrder: "asc" },
}),
this.prisma.brandFieldDefinition.findMany({
where: { brandId, isVisible: true },
orderBy: { sortOrder: "asc" },
}),
this.prisma.offering.findMany({
where: { brandId, isEnabled: true },
orderBy: { sortOrder: "asc" },
}),
this.prisma.inquiryForm.findFirst({
where: { brandId, isEnabled: true },
orderBy: { updatedAt: "desc" },
}),
this.prisma.brandTemplateInstallation.findFirst({
where: { brandId },
orderBy: { updatedAt: "desc" },
}),
this.prisma.capabilityInstallation.findMany({ where: { brandId } }),
this.prisma.trustContent.findMany({
where: { brandId, isPublished: true },
orderBy: { sortOrder: "asc" },
}),
]);
const templateKey = installation?.templateKey ?? brand?.templateKey ?? "personal";
const template = getBrandTemplate(templateKey);
const runtimeCapabilities = capabilityInstallations.length
@@ -314,6 +326,7 @@ export class PublicWorkspaceController {
runtimeModules,
fields,
offerings,
trustContent: trustContents,
inquiryForm,
};
}