feat: 增加门窗行业模板声明与验收夹具
This commit is contained in:
1 parent
8b85cc0403
commit
041a6a7f02
7 files changed
+70
-9
No files matched your search
@@ -13,7 +13,7 @@ import {
|
|||||||
|
|
||||||
export class UpdateBrandDto {
|
export class UpdateBrandDto {
|
||||||
@IsOptional() @IsString() name?: string;
|
@IsOptional() @IsString() name?: string;
|
||||||
@IsOptional() @IsIn(["food", "personal"]) templateKey?: "food" | "personal";
|
@IsOptional() @IsIn(["food", "personal", "doors"]) templateKey?: "food" | "personal" | "doors";
|
||||||
@IsOptional() @IsString() tagline?: string;
|
@IsOptional() @IsString() tagline?: string;
|
||||||
@IsOptional() @IsString() description?: string;
|
@IsOptional() @IsString() description?: string;
|
||||||
@IsOptional() @IsString() avatarUrl?: string;
|
@IsOptional() @IsString() avatarUrl?: string;
|
||||||
@@ -75,8 +75,8 @@ export class UpdateBookingTagsDto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class InstallTemplateDto {
|
export class InstallTemplateDto {
|
||||||
@IsIn(["personal", "food"])
|
@IsIn(["personal", "food", "doors"])
|
||||||
templateKey!: "personal" | "food";
|
templateKey!: "personal" | "food" | "doors";
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateCapabilityInstallationDto {
|
export class UpdateCapabilityInstallationDto {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { PrismaService } from "./prisma.service.js";
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class TemplateWorkspaceService {
|
export class TemplateWorkspaceService {
|
||||||
constructor(private readonly prisma: PrismaService) {}
|
constructor(private readonly prisma: PrismaService) {}
|
||||||
async install(brandId: string, templateKey: "personal" | "food") {
|
async install(brandId: string, templateKey: "personal" | "food" | "doors") {
|
||||||
const template = getBrandTemplate(templateKey);
|
const template = getBrandTemplate(templateKey);
|
||||||
if (!template) throw new BadRequestException("行业模板不存在");
|
if (!template) throw new BadRequestException("行业模板不存在");
|
||||||
const existing = await this.prisma.brandTemplateInstallation.findFirst({ where: { brandId } });
|
const existing = await this.prisma.brandTemplateInstallation.findFirst({ where: { brandId } });
|
||||||
|
|||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"templateKey": "doors",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"pages": ["home", "offerings", "detail", "inquiry", "success", "records", "profile"],
|
||||||
|
"layout": { "home": ["brand-hero", "founder-card", "trust-proof", "offering-list"] },
|
||||||
|
"requiredModules": [
|
||||||
|
"brand-hero",
|
||||||
|
"founder-card",
|
||||||
|
"trust-proof",
|
||||||
|
"offering-list",
|
||||||
|
"offering-detail",
|
||||||
|
"inquiry-form",
|
||||||
|
"records",
|
||||||
|
"profile",
|
||||||
|
"success-summary"
|
||||||
|
],
|
||||||
|
"requiredCapabilities": ["offerings", "inquiry"],
|
||||||
|
"visualAnchors": { "home": ["brand-hero", "founder-card", "trust-proof", "offering-list"] }
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
const fs = require("node:fs");
|
const fs = require("node:fs");
|
||||||
const path = require("node:path");
|
const path = require("node:path");
|
||||||
const root = path.resolve(__dirname, "..");
|
const root = path.resolve(__dirname, "..");
|
||||||
const fixtureFiles = ["linjing-door.json", "minimal-neutral.json"];
|
const fixtureFiles = ["linjing-door.json", "minimal-neutral.json", "doors-industry.json"];
|
||||||
const fixtures = fixtureFiles.map((file) => JSON.parse(fs.readFileSync(path.join(__dirname, "fixtures", file), "utf8")));
|
const fixtures = fixtureFiles.map((file) => JSON.parse(fs.readFileSync(path.join(__dirname, "fixtures", file), "utf8")));
|
||||||
for (const fixture of fixtures) {
|
for (const fixture of fixtures) {
|
||||||
const modules = fixture.requiredModules.map((key) => path.join(root, "components/modules", key));
|
const modules = fixture.requiredModules.map((key) => path.join(root, "components/modules", key));
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ export interface ApiErrorBody {
|
|||||||
requestId: string | null;
|
requestId: string | null;
|
||||||
}
|
}
|
||||||
export interface BrandTemplateDefinition {
|
export interface BrandTemplateDefinition {
|
||||||
key: "personal" | "food";
|
key: "personal" | "food" | "doors";
|
||||||
version: string;
|
version: string;
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
@@ -471,7 +471,7 @@ export class ApiClient {
|
|||||||
}> {
|
}> {
|
||||||
return this.request("/admin/workspace");
|
return this.request("/admin/workspace");
|
||||||
}
|
}
|
||||||
installAdminTemplate(templateKey: "personal" | "food"): Promise<unknown> {
|
installAdminTemplate(templateKey: "personal" | "food" | "doors"): Promise<unknown> {
|
||||||
return this.request("/admin/workspace/install", { method: "POST", body: { templateKey } });
|
return this.request("/admin/workspace/install", { method: "POST", body: { templateKey } });
|
||||||
}
|
}
|
||||||
listAdminCapabilities(): Promise<CapabilityInstallation[]> {
|
listAdminCapabilities(): Promise<CapabilityInstallation[]> {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export const configPackageName = "personal-brand-config";
|
export const configPackageName = "personal-brand-config";
|
||||||
|
|
||||||
export type BrandTemplateKey = "personal" | "food";
|
export type BrandTemplateKey = "personal" | "food" | "doors";
|
||||||
export type VisualTemplateKey = "linjing-editorial" | "minimal-neutral";
|
export type VisualTemplateKey = "linjing-editorial" | "minimal-neutral";
|
||||||
export type CapabilityKey = "offerings" | "inquiry" | "booking";
|
export type CapabilityKey = "offerings" | "inquiry" | "booking";
|
||||||
|
|
||||||
@@ -224,6 +224,48 @@ export const brandTemplates = {
|
|||||||
],
|
],
|
||||||
capabilities: ["offerings", "inquiry", "booking"],
|
capabilities: ["offerings", "inquiry", "booking"],
|
||||||
},
|
},
|
||||||
|
doors: {
|
||||||
|
key: "doors",
|
||||||
|
version: "1.0.0",
|
||||||
|
name: "高端门窗模板",
|
||||||
|
description: "适用于别墅门、院门、室内门与定制门窗服务的行业模板。",
|
||||||
|
serviceCategories: ["entrance-door", "garden-door", "interior-door", "custom"],
|
||||||
|
trustContentTypes: [
|
||||||
|
"profile",
|
||||||
|
"experience",
|
||||||
|
"credential",
|
||||||
|
"portfolio",
|
||||||
|
"process",
|
||||||
|
"testimonial",
|
||||||
|
],
|
||||||
|
modules: [
|
||||||
|
{ key: "identity", type: "identity", title: "品牌身份", required: true },
|
||||||
|
{ key: "trust", type: "trust", title: "工艺与信任", required: true },
|
||||||
|
{ key: "offerings", type: "offering", title: "门窗系列", required: true },
|
||||||
|
{ key: "inquiry", type: "inquiry", title: "设计咨询", required: true },
|
||||||
|
{ key: "contact", type: "contact", title: "品牌表达", required: true },
|
||||||
|
],
|
||||||
|
fields: [
|
||||||
|
{ scope: "profile", key: "name", label: "品牌名称", type: "text", required: true },
|
||||||
|
{ scope: "profile", key: "tagline", label: "一句话定位", type: "text", required: true },
|
||||||
|
{ scope: "profile", key: "audience", label: "服务对象", type: "textarea", required: true },
|
||||||
|
{
|
||||||
|
scope: "profile",
|
||||||
|
key: "valueProposition",
|
||||||
|
label: "提供的价值",
|
||||||
|
type: "textarea",
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scope: "profile",
|
||||||
|
key: "trustProof",
|
||||||
|
label: "信任证明入口",
|
||||||
|
type: "textarea",
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
capabilities: ["offerings", "inquiry"],
|
||||||
|
},
|
||||||
} satisfies Record<BrandTemplateKey, BrandTemplateDefinition>;
|
} satisfies Record<BrandTemplateKey, BrandTemplateDefinition>;
|
||||||
|
|
||||||
export function isBrandTemplateKey(value: string): value is BrandTemplateKey {
|
export function isBrandTemplateKey(value: string): value is BrandTemplateKey {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ export type BookingRequestType = "package" | "private_chef" | "inquiry";
|
|||||||
export type ContactPreference = "wechat" | "phone" | "none";
|
export type ContactPreference = "wechat" | "phone" | "none";
|
||||||
export type FulfillmentType = "pickup" | "delivery";
|
export type FulfillmentType = "pickup" | "delivery";
|
||||||
export type OrderStatus = BookingStatus;
|
export type OrderStatus = BookingStatus;
|
||||||
export type BrandTemplateKey = "food" | "personal";
|
export type BrandTemplateKey = "food" | "personal" | "doors";
|
||||||
export const BRAND_TEMPLATE = { FOOD: "food", PERSONAL: "personal" } as const satisfies Record<
|
export const BRAND_TEMPLATE = { FOOD: "food", PERSONAL: "personal" } as const satisfies Record<
|
||||||
Uppercase<BrandTemplateKey>,
|
Uppercase<BrandTemplateKey>,
|
||||||
BrandTemplateKey
|
BrandTemplateKey
|
||||||
|
|||||||
Reference in new issue
Block a user