import { Entity, Column } from 'typeorm';
import { BaseModel } from '../../frame/BaseModel';
import * as dayjs from 'dayjs';
// 新闻
@Entity('news')
export class News extends BaseModel {
  @Column({ type: 'jsonb', nullable: true, comment: '标签' })
  tags: Array<any>;
  @Column({ type: 'character varying', nullable: true, comment: '标题' })
  title: string;
  @Column({ type: 'jsonb', default: [], nullable: true, comment: '封面' })
  logo: Array<any>;
  @Column({ type: 'character varying', nullable: true, comment: '发布人' })
  person: string;
  @Column({ type: 'timestamp without time zone', nullable: true, comment: '发布时间', transformer: { from: value => dayjs(value).format('YYYY-MM-DD HH:mm:ss'), to: value => value } })
  time: Date;
  @Column({ type: 'character varying', nullable: true, comment: '内容' })
  content: string;
  @Column({ type: 'integer', nullable: true, comment: '浏览次数', default: 0 })
  number: number;
  @Column({ type: 'character varying', nullable: true, comment: '类型 0:政策新闻,1:新闻资讯', default: '0' })
  type: string;
  @Column({ type: 'character varying', nullable: true, comment: '是否使用', default: '1' })
  is_use: string;
  @Column({ type: 'character varying', nullable: true, comment: '状态', default: '0' })
  status: string;
}
