forked from yoone/API
63 lines
1.6 KiB
TypeScript
63 lines
1.6 KiB
TypeScript
import { Rule, RuleType } from '@midwayjs/validate';
|
|
|
|
// 创建字典的数据传输对象
|
|
export class CreateDictDTO {
|
|
@Rule(RuleType.string().required())
|
|
name: string; // 字典名称
|
|
|
|
@Rule(RuleType.string().required())
|
|
title: string; // 字典标题
|
|
}
|
|
|
|
// 更新字典的数据传输对象
|
|
export class UpdateDictDTO {
|
|
@Rule(RuleType.string())
|
|
name?: string; // 字典名称 (可选)
|
|
|
|
@Rule(RuleType.string())
|
|
title?: string; // 字典标题 (可选)
|
|
}
|
|
|
|
// 创建字典项的数据传输对象
|
|
export class CreateDictItemDTO {
|
|
@Rule(RuleType.string().required())
|
|
name: string; // 字典项名称
|
|
|
|
@Rule(RuleType.string().required())
|
|
title: string; // 字典项标题
|
|
|
|
@Rule(RuleType.string().allow('').allow(null))
|
|
titleCN?: string; // 字典项中文标题 (可选)
|
|
|
|
@Rule(RuleType.string().allow('').allow(null))
|
|
image?: string; // 图片 (可选)
|
|
|
|
@Rule(RuleType.string().allow('').allow(null))
|
|
shortName?: string; // 简称 (可选)
|
|
|
|
@Rule(RuleType.number().required())
|
|
dictId: number; // 所属字典的ID
|
|
}
|
|
|
|
// 更新字典项的数据传输对象
|
|
export class UpdateDictItemDTO {
|
|
@Rule(RuleType.string())
|
|
name?: string; // 字典项名称 (可选)
|
|
|
|
@Rule(RuleType.string())
|
|
title?: string; // 字典项标题 (可选)
|
|
|
|
@Rule(RuleType.string().allow('').allow(null))
|
|
titleCN?: string; // 字典项中文标题 (可选)
|
|
|
|
@Rule(RuleType.string().allow(null))
|
|
value?: string; // 字典项值 (可选)
|
|
|
|
@Rule(RuleType.string().allow('').allow(null))
|
|
image?: string; // 图片 (可选)
|
|
|
|
@Rule(RuleType.string().allow('').allow(null))
|
|
shortName?: string; // 简称 (可选)
|
|
|
|
}
|