import { Entity, Column } from 'typeorm';
import { BaseModel } from '../../frame/BaseModel';
import * as dayjs from 'dayjs';
// 聊天
@Entity('chat')
export class Chat extends BaseModel {
  @Column({ type: 'integer', comment: '发送者id' })
  sender_id: number;
  @Column({ type: 'integer', comment: '接收者id' })
  receiver_id: number;
  @Column({ type: 'character varying', comment: '内容类型' })
  type: string;
  @Column({ type: 'text', comment: '内容' })
  content: string;
  @Column({ type: 'timestamp without time zone', comment: '发送时间', transformer: { from: value => dayjs(value).format('YYYY-MM-DD HH:mm:ss'), to: value => value } })
  send_time: Date;
  @Column({ type: 'character varying', comment: '是否已读', default: '0' })
  is_read: string;
}
