调整数据库结构、添加博客权限enum

This commit is contained in:
2025-06-22 23:25:38 +08:00
parent 0889225257
commit f3193226e7
3 changed files with 17 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
export enum BlogPermission {
Public = 'Public',
ByPassword = 'ByPassword',
List = 'List',
}

View File

@@ -8,6 +8,7 @@ import {
UpdateDateColumn, UpdateDateColumn,
} from 'typeorm'; } from 'typeorm';
import { BlogComment } from './BlogComment.entity'; import { BlogComment } from './BlogComment.entity';
import { BlogPermission } from '../Blog.Permission.enum';
@Entity() @Entity()
export class Blog { export class Blog {
@@ -35,7 +36,12 @@ export class Blog {
@DeleteDateColumn({ precision: 3, nullable: true }) @DeleteDateColumn({ precision: 3, nullable: true })
deletedAt: Date; deletedAt: Date;
// 权限关系 TODO // 权限
@Column('simple-array', { default: '' })
permissions: BlogPermission[];
@Column({ nullable: true })
password_hash: string | null;
// 关系 // 关系
@OneToMany(() => BlogComment, (blog) => blog.id) @OneToMany(() => BlogComment, (blog) => blog.id)

View File

@@ -0,0 +1,5 @@
export enum BlogPermission {
Public = 'Public',
ByPassword = 'ByPassword',
List = 'List',
}