fix: 收敛模板编辑发布契约并还原餐饮页面视觉

This commit is contained in:
que01 committed 2026-10-08 13:36:59 +08:00
1 parent 20bcb43534
commit f4061a24bd
102 files changed
+4510 -870

No files matched your search

+20 -5
View File
@@ -12,6 +12,7 @@ import {
getDefaultVisualTemplateKey,
getTemplatePackageManifestForVisualKey,
} from "@personal-brand/config";
import { isTrustContentComplete } from "@personal-brand/types";
import { PrismaService } from "./prisma.service.js";
import { BrandReleaseService } from "./brand-release.service.js";
import { validateFieldSnapshot } from "@personal-brand/validation";
@@ -80,11 +81,14 @@ export class BrandReleaseApiService {
}),
database.trustContent.findMany({
where: { brandId, isPublished: true },
select: { type: true, title: true, content: true },
select: { type: true, title: true, content: true, config: true },
}),
]);
const validTrustItems = trustItems.filter(
(item) => item.title.trim().length > 0 && item.content.trim().length > 0,
const validTrustItems = trustItems.filter((item) =>
isTrustContentComplete(
item,
packageManifest?.trustContentTypes?.find((type) => type.type === item.type),
),
);
const offeringIds = new Set(offerings.map((item) => item.id));
const usableForms = forms.filter(
@@ -145,8 +149,19 @@ export class BrandReleaseApiService {
checks.push({
key: `trust:${type.type}`,
label: `请完善${type.label}`,
passed: publishedTrustTypes.has(type.type),
help: ["标题和详细内容都填写后才能发布。", type.help].filter(Boolean).join(" "),
passed:
publishedTrustTypes.has(type.type) &&
(type.maxPublishedItems === undefined ||
trustItems.filter((item) => item.type === type.type).length <= type.maxPublishedItems),
help: [
"请完整填写该区块的可编辑字段。",
type.maxPublishedItems === undefined
? undefined
: `此区块最多保留 ${type.maxPublishedItems} 条公开记录。`,
type.help,
]
.filter(Boolean)
.join(" "),
destination: "/admin/trust",
});
}