12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- import { OmitDto, Rule, RuleType } from '@midwayjs/validate';
- import { ApiProperty } from '@midwayjs/swagger';
- import _ = require('lodash');
- import { SearchBase } from 'free-midway-component';
- export class FetchVO_chatRecord {
- constructor(data: object) {
- for (const key of Object.keys(this)) {
- this[key] = _.get(data, key);
- }
- }
- @ApiProperty({ description: '数据id' })
- _id: string = undefined;
- @ApiProperty({ description: '房间' })
- 'room': string = undefined;
- @ApiProperty({ description: '发言人' })
- 'speaker': string = undefined;
- @ApiProperty({ description: '内容' })
- 'content': string = undefined;
- @ApiProperty({ description: '时间' })
- 'time': string = undefined;
- @ApiProperty({ description: '消息类型' })
- 'msg_type': string = undefined;
- @ApiProperty({ description: '是否已读' })
- 'is_read': string = undefined;
- }
- export class QueryDTO_chatRecord extends SearchBase {
- constructor() {
- const like_prop = [];
- const props = ['room', 'speaker', 'time', 'is_read'];
- const mapping = [];
- super({ like_prop, props, mapping });
- }
- @ApiProperty({ description: '房间' })
- 'room': string = undefined;
- @ApiProperty({ description: '发言人' })
- 'speaker': string = undefined;
- @ApiProperty({ description: '时间' })
- 'time': string = undefined;
- @ApiProperty({ description: '是否已读' })
- 'is_read': string = undefined;
- }
- export class QueryVO_chatRecord extends FetchVO_chatRecord {}
- export class CreateDTO_chatRecord {
- @ApiProperty({ description: '房间' })
- @Rule(RuleType['string']().empty(''))
- 'room': string = undefined;
- @ApiProperty({ description: '发言人' })
- @Rule(RuleType['string']().empty(''))
- 'speaker': string = undefined;
- @ApiProperty({ description: '内容' })
- @Rule(RuleType['string']().empty(''))
- 'content': string = undefined;
- @ApiProperty({ description: '时间' })
- @Rule(RuleType['string']().empty(''))
- 'time': string = undefined;
- @ApiProperty({ description: '消息类型' })
- @Rule(RuleType['string']().empty(''))
- 'msg_type': string = undefined;
- // 如果没有房间id, 那么顾客id和店铺id就传1个就行,另一个位置为发言人
- @ApiProperty({ description: '顾客' })
- @Rule(RuleType['string']().empty(''))
- 'customer': string = undefined;
- @ApiProperty({ description: '店铺' })
- @Rule(RuleType['string']().empty(''))
- 'shop': string = undefined;
- }
- export class CreateVO_chatRecord extends FetchVO_chatRecord {}
- export class UpdateDTO_chatRecord extends OmitDto(CreateDTO_chatRecord, ['customer', 'shop']) {
- @ApiProperty({ description: '数据id' })
- @Rule(RuleType['string']().empty(''))
- _id: string = undefined;
- }
- export class UpdateVO_chatRecord extends FetchVO_chatRecord {}
- export class ReadDTO {
- @ApiProperty({ description: '阅读的数据id' })
- @Rule(RuleType.array().min(1))
- ids: Array<string> = undefined;
- }
|