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_team { constructor(data: object) { dealVO(this, data); } @ApiProperty({ description: '数据id' }) _id: string = undefined; @ApiProperty({ description: '所属管理员' }) 'administrator': string = undefined; @ApiProperty({ description: '团队名称' }) 'name': string = undefined; @ApiProperty({ description: '成立时间' }) 'create_time': string = undefined; @ApiProperty({ description: '单位地址' }) 'address': string = undefined; @ApiProperty({ description: '手机号' }) 'phone': string = undefined; @ApiProperty({ description: '团队logo' }) 'logo': Array = undefined; @ApiProperty({ description: '团队人数' }) 'number': string = undefined; @ApiProperty({ description: '团队成员' }) 'member': Array = undefined; @ApiProperty({ description: '状态' }) 'status': string = undefined; } export class QDTO_team extends SearchBase { constructor() { const like_prop = ['name']; const props = [ 'administrator', 'name', 'create_time', 'phone', 'number', 'status', ]; const mapping = []; super({ like_prop, props, mapping }); } @ApiProperty({ description: '所属管理员' }) 'administrator': string = undefined; @ApiProperty({ description: '团队名称' }) 'name': string = undefined; @ApiProperty({ description: '成立时间' }) 'create_time': string = undefined; @ApiProperty({ description: '手机号' }) 'phone': string = undefined; @ApiProperty({ description: '团队人数' }) 'number': string = undefined; @ApiProperty({ description: '状态' }) 'status': string = undefined; } export class QVO_team extends FVO_team { constructor(data: object) { super(data); dealVO(this, data); } } export class CDTO_team { @ApiProperty({ description: '所属管理员' }) @Rule(RuleType['string']().allow('', null)) 'administrator': string = undefined; @ApiProperty({ description: '团队名称' }) @Rule(RuleType['string']().allow('', null)) 'name': string = undefined; @ApiProperty({ description: '成立时间' }) @Rule(RuleType['string']().allow('', null)) 'create_time': string = undefined; @ApiProperty({ description: '单位地址' }) @Rule(RuleType['string']().allow('', null)) 'address': string = undefined; @ApiProperty({ description: '手机号' }) @Rule(RuleType['string']().allow('', null)) 'phone': string = undefined; @ApiProperty({ description: '团队logo' }) @Rule(RuleType['array']().allow('', null)) 'logo': Array = undefined; @ApiProperty({ description: '团队人数' }) @Rule(RuleType['string']().allow('', null)) 'number': string = undefined; @ApiProperty({ description: '团队成员' }) @Rule(RuleType['array']().allow('', null)) 'member': Array = undefined; @ApiProperty({ description: '状态' }) @Rule(RuleType['string']().allow('', null)) 'status': string = undefined; } export class CVO_team extends FVO_team { constructor(data: object) { super(data); dealVO(this, data); } } export class UDTO_team extends CDTO_team { @ApiProperty({ description: '数据id' }) @Rule(RuleType['string']().empty('')) _id: string = undefined; } export class UVAO_team extends FVO_team { constructor(data: object) { super(data); dealVO(this, data); } }