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_channel { constructor(data: object) { dealVO(this, data); } @ApiProperty({ description: '数据id' }) _id: string = undefined; @ApiProperty({ description: '房间号' }) 'room_id': string = undefined; @ApiProperty({ description: '用户类型' }) 'type': string = undefined; @ApiProperty({ description: '密码' }) 'password': string = undefined; @ApiProperty({ description: '标题' }) 'title': string = undefined; @ApiProperty({ description: '来源' }) 'origin': string = undefined; @ApiProperty({ description: '类别' }) 'channel_type': string = undefined; @ApiProperty({ description: '简介' }) 'brief': string = undefined; @ApiProperty({ description: '状态' }) 'status': string = undefined; } export class QDTO_channel extends SearchBase { constructor() { const like_prop = []; const props = [ 'room_id', 'type', 'title', 'origin', 'channel_type', 'status', ]; const mapping = []; super({ like_prop, props, mapping }); } @ApiProperty({ description: '房间号' }) 'room_id': string = undefined; @ApiProperty({ description: '用户类型' }) 'type': string = undefined; @ApiProperty({ description: '标题' }) 'title': string = undefined; @ApiProperty({ description: '来源' }) 'origin': string = undefined; @ApiProperty({ description: '类别' }) 'channel_type': string = undefined; @ApiProperty({ description: '状态' }) 'status': string = undefined; } export class QVO_channel extends FVO_channel { constructor(data: object) { super(data); dealVO(this, data); } } export class CDTO_channel { @ApiProperty({ description: '房间号' }) @Rule(RuleType['string']().empty('')) 'room_id': string = undefined; @ApiProperty({ description: '用户类型' }) @Rule(RuleType['string']().empty('')) 'type': string = undefined; @ApiProperty({ description: '密码' }) @Rule(RuleType['string']().empty('')) 'password': string = undefined; @ApiProperty({ description: '标题' }) @Rule(RuleType['string']().empty('')) 'title': string = undefined; @ApiProperty({ description: '来源' }) @Rule(RuleType['string']().empty('')) 'origin': string = undefined; @ApiProperty({ description: '类别' }) @Rule(RuleType['string']().empty('')) 'channel_type': string = undefined; @ApiProperty({ description: '简介' }) @Rule(RuleType['string']().empty('')) 'brief': string = undefined; @ApiProperty({ description: '状态' }) @Rule(RuleType['string']().empty('')) 'status': string = undefined; } export class CVO_channel extends FVO_channel { constructor(data: object) { super(data); dealVO(this, data); } } export class UDTO_channel extends CDTO_channel { @ApiProperty({ description: '数据id' }) @Rule(RuleType['string']().empty('')) _id: string = undefined; } export class UVAO_channel extends FVO_channel { constructor(data: object) { super(data); dealVO(this, data); } }