fix(server): tag upsert (#12141)

This commit is contained in:
Jason Rasmussen
2024-08-30 12:44:24 -04:00
committed by GitHub
parent b9e5e40ced
commit 9b1a985d29
14 changed files with 163 additions and 41 deletions

View File

@@ -10,16 +10,18 @@ import {
Tree,
TreeChildren,
TreeParent,
Unique,
UpdateDateColumn,
} from 'typeorm';
@Entity('tags')
@Unique(['userId', 'value'])
@Tree('closure-table')
export class TagEntity {
@PrimaryGeneratedColumn('uuid')
id!: string;
@Column({ unique: true })
@Column()
value!: string;
@CreateDateColumn({ type: 'timestamptz' })
@@ -31,6 +33,9 @@ export class TagEntity {
@Column({ type: 'varchar', nullable: true, default: null })
color!: string | null;
@Column({ nullable: true })
parentId?: string;
@TreeParent({ onDelete: 'CASCADE' })
parent?: TagEntity;