|
@@ -0,0 +1,82 @@
|
|
|
+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_collection {
|
|
|
+ constructor(data: object) {
|
|
|
+ dealVO(this, data);
|
|
|
+ }
|
|
|
+ @ApiProperty({ description: '数据id' })
|
|
|
+ _id: string = undefined;
|
|
|
+ @ApiProperty({ description: '平台用户id' })
|
|
|
+ 'user': string = undefined;
|
|
|
+ @ApiProperty({ description: '来源id' })
|
|
|
+ 'source': string = undefined;
|
|
|
+ @ApiProperty({ description: '类型' })
|
|
|
+ 'type': string = undefined;
|
|
|
+ @ApiProperty({ description: '收藏时间' })
|
|
|
+ 'time': string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class QDTO_collection extends SearchBase {
|
|
|
+ constructor() {
|
|
|
+ const like_prop = [];
|
|
|
+ const props = ['user', 'source', 'type'];
|
|
|
+ const mapping = [];
|
|
|
+ super({ like_prop, props, mapping });
|
|
|
+ }
|
|
|
+ @ApiProperty({ description: '平台用户id' })
|
|
|
+ 'user': string = undefined;
|
|
|
+ @ApiProperty({ description: '来源id' })
|
|
|
+ 'source': string = undefined;
|
|
|
+ @ApiProperty({ description: '类型' })
|
|
|
+ 'type': string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class QVO_collection extends FVO_collection {
|
|
|
+ constructor(data: object) {
|
|
|
+ super(data);
|
|
|
+ dealVO(this, data);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class CDTO_collection {
|
|
|
+ @ApiProperty({ description: '平台用户id' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'user': string = undefined;
|
|
|
+ @ApiProperty({ description: '来源id' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'source': string = undefined;
|
|
|
+ @ApiProperty({ description: '类型' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'type': string = undefined;
|
|
|
+ @ApiProperty({ description: '收藏时间' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'time': string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class CVO_collection extends FVO_collection {
|
|
|
+ constructor(data: object) {
|
|
|
+ super(data);
|
|
|
+ dealVO(this, data);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class UDTO_collection extends CDTO_collection {
|
|
|
+ @ApiProperty({ description: '数据id' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ _id: string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class UVAO_collection extends FVO_collection {
|
|
|
+ constructor(data: object) {
|
|
|
+ super(data);
|
|
|
+ dealVO(this, data);
|
|
|
+ }
|
|
|
+}
|