|
@@ -0,0 +1,90 @@
|
|
|
+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_chat {
|
|
|
+ constructor(data: object) {
|
|
|
+ dealVO(this, data);
|
|
|
+ }
|
|
|
+ @ApiProperty({ description: '数据id' })
|
|
|
+ _id: string = undefined;
|
|
|
+ @ApiProperty({ description: '发送者id' })
|
|
|
+ 'sender_id': string = undefined;
|
|
|
+ @ApiProperty({ description: '接收者id' })
|
|
|
+ 'receiver_id': string = undefined;
|
|
|
+ @ApiProperty({ description: '内容类型' })
|
|
|
+ 'type': string = undefined;
|
|
|
+ @ApiProperty({ description: '内容' })
|
|
|
+ 'content': string = undefined;
|
|
|
+ @ApiProperty({ description: '发送时间' })
|
|
|
+ 'send_time': string = undefined;
|
|
|
+ @ApiProperty({ description: '是否已读' })
|
|
|
+ 'is_read': string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class QDTO_chat extends SearchBase {
|
|
|
+ constructor() {
|
|
|
+ const like_prop = [];
|
|
|
+ const props = ['sender_id', 'content'];
|
|
|
+ const mapping = [];
|
|
|
+ super({ like_prop, props, mapping });
|
|
|
+ }
|
|
|
+ @ApiProperty({ description: '发送者id' })
|
|
|
+ 'sender_id': string = undefined;
|
|
|
+ @ApiProperty({ description: '内容' })
|
|
|
+ 'content': string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class QVO_chat extends FVO_chat {
|
|
|
+ constructor(data: object) {
|
|
|
+ super(data);
|
|
|
+ dealVO(this, data);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class CDTO_chat {
|
|
|
+ @ApiProperty({ description: '发送者id' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'sender_id': string = undefined;
|
|
|
+ @ApiProperty({ description: '接收者id' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'receiver_id': string = undefined;
|
|
|
+ @ApiProperty({ description: '内容类型' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'type': string = undefined;
|
|
|
+ @ApiProperty({ description: '内容' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'content': string = undefined;
|
|
|
+ @ApiProperty({ description: '发送时间' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'send_time': string = undefined;
|
|
|
+ @ApiProperty({ description: '是否已读' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ 'is_read': string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class CVO_chat extends FVO_chat {
|
|
|
+ constructor(data: object) {
|
|
|
+ super(data);
|
|
|
+ dealVO(this, data);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class UDTO_chat extends CDTO_chat {
|
|
|
+ @ApiProperty({ description: '数据id' })
|
|
|
+ @Rule(RuleType['string']().empty(''))
|
|
|
+ _id: string = undefined;
|
|
|
+}
|
|
|
+
|
|
|
+export class UVAO_chat extends FVO_chat {
|
|
|
+ constructor(data: object) {
|
|
|
+ super(data);
|
|
|
+ dealVO(this, data);
|
|
|
+ }
|
|
|
+}
|