文件
OmniCard/backend/src/modules/card/entity/cases.ts

92 行
1.9 KiB
TypeScript

import { BaseEntity, transformerJson } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';
import type { CardCase } from '../../../comm/types/omni';
/**
* 标杆案例作品集实体
* 映射数据表 card_cases,严格契合 CardCase 跨端数据契约
*/
@Entity('card_cases')
export class CardCasesEntity extends BaseEntity implements CardCase {
@Index()
@Column({
name: 'card_id',
comment: '所属名片 ID',
type: 'bigint',
})
cardId: number;
@Column({
name: 'title',
comment: '案例标题/项目名称',
length: 150,
})
title: string;
@Column({
name: 'client',
comment: '客户/合作品牌名称',
length: 100,
nullable: true,
})
client: string;
@Column({
name: 'duration',
comment: '项目周期 (如: 2024.01 - 2024.06)',
length: 50,
nullable: true,
})
duration: string;
@Column({
name: 'metrics',
comment: '量化成效/KPI (如: +150% 留资率, 2M+ 曝光)',
length: 255,
nullable: true,
})
metrics: string;
@Column({
name: 'cover_image',
comment: '案例封面图 URL',
length: 500,
nullable: true,
})
coverImage: string;
@Column({
name: 'pdf_url',
comment: '案例详情 PDF / 白皮书 URL',
length: 500,
nullable: true,
})
pdfUrl: string;
@Column({
name: 'description',
comment: '案例详情简述/背景成果',
type: 'text',
nullable: true,
})
description: string;
@Column({
name: 'meta_json',
comment: '扩展元数据 JSON (包含 images 相册图片数组、kpis 量化指标等)',
type: 'json',
nullable: true,
transformer: transformerJson,
})
metaJson?: Record<string, unknown> | string;
@Index()
@Column({
name: 'sort_order',
comment: '排序序号 (升序)',
type: 'int',
default: 0,
})
sortOrder: number;
}