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

58 lines
1.2 KiB
TypeScript
Raw Normal View History

2022-06-29 16:03:02 +00:00
import { AuthEnum } from '@think/domains';
import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
@Entity('auth')
export class AuthEntity {
@PrimaryGeneratedColumn('uuid')
public id: string;
/**
* Id
*/
@Column({ type: 'varchar', comment: '关联用户 Id' })
public userId: string;
/**
*
*/
@Column({
type: 'enum',
enum: AuthEnum,
default: AuthEnum.noAccess,
comment: '权限类型',
})
public auth: AuthEnum;
/**
* Id
*/
@Column({ type: 'varchar', comment: '所属组织 Id' })
public organizationId: string;
/**
* Id
*/
@Column({ type: 'varchar', default: null, comment: '所属知识库 Id' })
public wikiId: string;
/**
* Id
*/
@Column({ type: 'varchar', default: null, comment: '所属文档 Id' })
public documentId: string;
@CreateDateColumn({
type: 'timestamp',
name: 'createdAt',
comment: '创建时间',
})
createdAt: Date;
@UpdateDateColumn({
type: 'timestamp',
name: 'updatedAt',
comment: '更新时间',
})
updatedAt: Date;
}