import { Rule, RuleType } from '@midwayjs/validate'; import { ApiProperty } from '@midwayjs/swagger'; import { SearchBase } from 'free-midway-component'; import get = require('lodash/get'); const dealVO = (cla, data) => { for (const key in cla) { const val = get(data, key); if (val || val === 0) cla[key] = val; } }; export class FVO_match { constructor(data: object) { dealVO(this, data); } @ApiProperty({ description: '数据id' }) _id: string = undefined; @ApiProperty({ description: '用户id' }) 'user': string = undefined; @ApiProperty({ description: '名称' }) 'name': string = undefined; @ApiProperty({ description: '类型' }) 'type': string = undefined; @ApiProperty({ description: '行业' }) 'industry': string = undefined; @ApiProperty({ description: '类别' }) 'form': string = undefined; @ApiProperty({ description: '有效期' }) 'time': Array = undefined; @ApiProperty({ description: '奖金' }) 'money': string = undefined; @ApiProperty({ description: '赛事规则' }) 'rules': object = undefined; @ApiProperty({ description: '简介' }) 'brief': string = undefined; @ApiProperty({ description: '封面' }) 'file': Array = undefined; @ApiProperty({ description: '赛事状态' }) 'match_status': string = undefined; @ApiProperty({ description: '是否公开' }) 'is_use': string = undefined; @ApiProperty({ description: '状态' }) 'status': string = undefined; } export class QDTO_match extends SearchBase { constructor() { const like_prop = ['name']; const props = ['user', 'industry', 'name', 'type', 'status', 'form', 'match_status', 'is_use']; const mapping = []; super({ like_prop, props, mapping }); } @ApiProperty({ description: '用户id' }) 'user': string = undefined; @ApiProperty({ description: '名称' }) 'name': string = undefined; @ApiProperty({ description: '类型' }) 'type': string = undefined; @ApiProperty({ description: '行业' }) 'industry': string = undefined; @ApiProperty({ description: '类别' }) 'form': string = undefined; @ApiProperty({ description: '赛事状态' }) 'match_status': string = undefined; @ApiProperty({ description: '是否公开' }) 'is_use': string = undefined; @ApiProperty({ description: '状态' }) 'status': string = undefined; } export class QVO_match extends FVO_match { constructor(data: object) { super(data); dealVO(this, data); } } export class CDTO_match { @ApiProperty({ description: '用户id' }) @Rule(RuleType['string']().empty('')) 'user': string = undefined; @ApiProperty({ description: '名称' }) @Rule(RuleType['string']().empty('')) 'name': string = undefined; @ApiProperty({ description: '类型' }) @Rule(RuleType['string']().empty('')) 'type': string = undefined; @ApiProperty({ description: '行业' }) @Rule(RuleType['string']().empty('')) 'industry': string = undefined; @ApiProperty({ description: '类别' }) @Rule(RuleType['string']().empty('')) 'form': string = undefined; @ApiProperty({ description: '有效期' }) @Rule(RuleType['array']().empty('')) 'time': Array = undefined; @ApiProperty({ description: '奖金' }) @Rule(RuleType['string']().empty('')) 'money': string = undefined; @ApiProperty({ description: '赛事规则' }) @Rule(RuleType['object']().empty('')) 'rules': object = undefined; @ApiProperty({ description: '简介' }) @Rule(RuleType['string']().empty('')) 'brief': string = undefined; @ApiProperty({ description: '封面' }) @Rule(RuleType['array']().empty('')) 'file': Array = undefined; @ApiProperty({ description: '赛事状态' }) @Rule(RuleType['string']().empty('')) 'match_status': string = undefined; @ApiProperty({ description: '是否公开' }) @Rule(RuleType['string']().empty('')) 'is_use': string = undefined; @ApiProperty({ description: '状态' }) @Rule(RuleType['string']().empty('')) 'status': string = undefined; } export class CVO_match extends FVO_match { constructor(data: object) { super(data); dealVO(this, data); } } export class UDTO_match extends CDTO_match { @ApiProperty({ description: '数据id' }) @Rule(RuleType['string']().empty('')) _id: string = undefined; } export class UVAO_match extends FVO_match { constructor(data: object) { super(data); dealVO(this, data); } }