feat: 完善模板驱动的品牌内容工作台
This commit is contained in:
1 parent
77224ea51f
commit
dd55af8d73
46 files changed
+2204
-295
No files matched your search
@@ -31,6 +31,8 @@ import {
|
||||
capabilityPlugins,
|
||||
getBrandTemplate,
|
||||
getTemplateSampleContent,
|
||||
getTemplatePackageManifestForVisualKey,
|
||||
getDefaultVisualTemplateKey,
|
||||
resolveCapabilities,
|
||||
} from "@personal-brand/config";
|
||||
import { TemplateWorkspaceService } from "./template-workspace.service.js";
|
||||
@@ -167,7 +169,32 @@ class AdminWorkspaceController {
|
||||
this.prisma.offering.findMany({ where: { brandId }, orderBy: { sortOrder: "asc" } }),
|
||||
this.prisma.inquiryForm.findMany({ where: { brandId }, orderBy: { updatedAt: "desc" } }),
|
||||
]);
|
||||
return { brand, installations, modules, fields, offerings, forms };
|
||||
const config = this.jsonObject(brand?.config);
|
||||
const templateKey =
|
||||
typeof config.visualTemplateKey === "string"
|
||||
? config.visualTemplateKey
|
||||
: getDefaultVisualTemplateKey(brand?.templateKey ?? "personal");
|
||||
const manifest = getTemplatePackageManifestForVisualKey(templateKey);
|
||||
return {
|
||||
brand,
|
||||
installations,
|
||||
modules,
|
||||
fields,
|
||||
offerings,
|
||||
forms,
|
||||
templateContent: manifest
|
||||
? {
|
||||
displayName: manifest.displayName,
|
||||
admin: manifest.admin,
|
||||
assetSlots: manifest.assetSlots,
|
||||
}
|
||||
: null,
|
||||
};
|
||||
}
|
||||
private jsonObject(value: unknown): Record<string, unknown> {
|
||||
return value && typeof value === "object" && !Array.isArray(value)
|
||||
? (value as Record<string, unknown>)
|
||||
: {};
|
||||
}
|
||||
@Post("install")
|
||||
async install(
|
||||
|
||||
Reference in new issue
Block a user