think/packages/server/src/entities/wiki.entity.ts

54 lines
1.1 KiB
TypeScript
Raw Normal View History

2022-02-20 11:51:55 +00:00
import {
Column,
CreateDateColumn,
Entity,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm';
2022-03-11 05:57:55 +00:00
import { WikiStatus } from '@think/domains';
import { DEFAULT_WIKI_AVATAR } from '@think/constants';
2022-02-20 11:51:55 +00:00
@Entity('wiki')
export class WikiEntity {
@PrimaryGeneratedColumn('uuid')
public id: string;
@Column({ type: 'varchar', length: 200, comment: '知识库名称' })
public name: string;
@Column({
type: 'varchar',
comment: '知识库头像',
default: DEFAULT_WIKI_AVATAR,
})
public avatar: string;
@Column({ type: 'varchar', comment: '描述信息', default: '' })
public description: string;
@Column({ type: 'varchar', comment: '创建用户 Id' })
public createUserId: string;
@Column({
type: 'enum',
enum: WikiStatus,
default: WikiStatus.private,
comment: '知识库状态',
})
public status: WikiStatus;
@CreateDateColumn({
type: 'timestamp',
name: 'created_at',
comment: '创建时间',
})
createdAt: Date;
@UpdateDateColumn({
type: 'timestamp',
name: 'updated_at',
comment: '更新时间',
})
updatedAt: Date;
}