refactor: 模板注册与默认模板收敛到目录驱动

This commit is contained in:
que01 committed 2026-10-12 10:00:46 +08:00
1 parent f87b26b201
commit 89fdfd7d83
25 files changed
+122 -96

No files matched your search

+3 -2
View File
@@ -1,6 +1,7 @@
import { Injectable } from "@nestjs/common";
import { Prisma } from "@prisma/client";
import {
defaultBrandTemplateKey,
getBrandTemplate,
getVisualTemplate,
getVisualTemplateManifest,
@@ -44,7 +45,7 @@ export async function buildBrandReleaseSnapshot(
database.trustContent.findMany({ where: { brandId }, orderBy: { sortOrder: "asc" } }),
database.capabilityInstallation.findMany({ where: { brandId } }),
]);
const templateKey = installation?.templateKey ?? brand?.templateKey ?? "personal";
const templateKey = installation?.templateKey ?? brand?.templateKey ?? defaultBrandTemplateKey;
const config =
brand?.config && typeof brand.config === "object" && !Array.isArray(brand.config)
? (brand.config as Record<string, unknown>)
@@ -52,7 +53,7 @@ export async function buildBrandReleaseSnapshot(
const visualKey =
typeof config.visualTemplateKey === "string"
? config.visualTemplateKey
: getDefaultVisualTemplateKey(brand?.templateKey ?? "personal");
: getDefaultVisualTemplateKey(brand?.templateKey ?? defaultBrandTemplateKey);
const jsonObject = (value: object): Record<string, unknown> =>
JSON.parse(JSON.stringify(value)) as Record<string, unknown>;
return {