1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- 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_module {
- constructor(data: object) {
- dealVO(this, data);
- }
- @ApiProperty({ description: '数据id' })
- _id: string = undefined;
- @ApiProperty({ description: '标题' })
- 'title': string = undefined;
- @ApiProperty({ description: '图片' })
- 'file': Array<any> = undefined;
- @ApiProperty({ description: '简介' })
- 'brief': string = undefined;
- @ApiProperty({ description: '路由' })
- 'route': string = undefined;
- @ApiProperty({ description: '排序' })
- 'sort': number = undefined;
- @ApiProperty({ description: '是否使用' })
- 'is_use': string = undefined;
- }
- export class QDTO_module extends SearchBase {
- constructor() {
- const like_prop = [];
- const props = ['title', 'is_use'];
- const mapping = [];
- super({ like_prop, props, mapping });
- }
- @ApiProperty({ description: '标题' })
- 'title': string = undefined;
- @ApiProperty({ description: '排序' })
- 'sort': number = undefined;
- @ApiProperty({ description: '是否使用' })
- 'is_use': string = undefined;
- }
- export class QVO_module extends FVO_module {
- constructor(data: object) {
- super(data);
- dealVO(this, data);
- }
- }
- export class CDTO_module {
- @ApiProperty({ description: '标题' })
- @Rule(RuleType['string']().empty(''))
- 'title': string = undefined;
- @ApiProperty({ description: '图片' })
- @Rule(RuleType['array']().empty(''))
- 'file': Array<any> = undefined;
- @ApiProperty({ description: '简介' })
- @Rule(RuleType['string']().empty(''))
- 'brief': string = undefined;
- @ApiProperty({ description: '路由' })
- @Rule(RuleType['string']().empty(''))
- 'route': string = undefined;
- @ApiProperty({ description: '排序' })
- @Rule(RuleType['number']().empty(''))
- 'sort': number = undefined;
- @ApiProperty({ description: '是否使用' })
- @Rule(RuleType['string']().empty(''))
- 'is_use': string = undefined;
- }
- export class CVO_module extends FVO_module {
- constructor(data: object) {
- super(data);
- dealVO(this, data);
- }
- }
- export class UDTO_module extends CDTO_module {
- @ApiProperty({ description: '数据id' })
- @Rule(RuleType['string']().empty(''))
- _id: string = undefined;
- }
- export class UVAO_module extends FVO_module {
- constructor(data: object) {
- super(data);
- dealVO(this, data);
- }
- }
|