diff --git a/BE/apps/api-server/src/modules/mindmap/mindmap.service.ts b/BE/apps/api-server/src/modules/mindmap/mindmap.service.ts index e71d3d60..ecd5f28d 100644 --- a/BE/apps/api-server/src/modules/mindmap/mindmap.service.ts +++ b/BE/apps/api-server/src/modules/mindmap/mindmap.service.ts @@ -95,14 +95,6 @@ export class MindmapService { throw new MindmapException('마인드맵을 찾을 수 없습니다.'); } - if (!nodes) { - return { - title: mindmap.title, - content: mindmap.content, - aiCount: mindmap.aiCount, - connectionId: mindmap.connectionId, - }; - } return { title: mindmap.title, content: mindmap.content, diff --git a/BE/libs/entity/src/mindmap.entity.ts b/BE/libs/entity/src/mindmap.entity.ts index 97516ac7..d70a7273 100644 --- a/BE/libs/entity/src/mindmap.entity.ts +++ b/BE/libs/entity/src/mindmap.entity.ts @@ -28,13 +28,19 @@ export class Mindmap { @Column({ name: 'ai_count', default: 5 }) aiCount: number; - @OneToMany(() => UserMindmapRole, (userMindmapRole) => userMindmapRole.mindmap) + @OneToMany(() => UserMindmapRole, (userMindmapRole) => userMindmapRole.mindmap, { + cascade: true, + onDelete: 'CASCADE', + }) userMindmapRoles: UserMindmapRole[]; @Column({ name: 'connection_id' }) connectionId: string; - @OneToMany(() => Node, (node) => node.mindmap) + @OneToMany(() => Node, (node) => node.mindmap, { + cascade: true, + onDelete: 'CASCADE', + }) nodes: Node[]; @CreateDateColumn({ type: 'timestamp', name: 'create_date' }) diff --git a/BE/libs/entity/src/node.entity.ts b/BE/libs/entity/src/node.entity.ts index 5414c87f..f295af2b 100644 --- a/BE/libs/entity/src/node.entity.ts +++ b/BE/libs/entity/src/node.entity.ts @@ -19,7 +19,7 @@ export class Node { @PrimaryGeneratedColumn() id: number; - @Column({ type: 'varchar', length: 32 }) + @Column({ type: 'varchar', length: 128 }) keyword: string; @Column({ name: 'location_x', type: 'float', default: 0 }) diff --git a/BE/libs/entity/src/user.entity.ts b/BE/libs/entity/src/user.entity.ts index 736b7ce7..cc9ef5cd 100644 --- a/BE/libs/entity/src/user.entity.ts +++ b/BE/libs/entity/src/user.entity.ts @@ -18,6 +18,9 @@ export class User { @CreateDateColumn({ type: 'timestamp', name: 'create_date' }) createDate: Date; - @OneToMany(() => UserMindmapRole, (userMindmapRole) => userMindmapRole.user) + @OneToMany(() => UserMindmapRole, (userMindmapRole) => userMindmapRole.user, { + cascade: true, + onDelete: 'CASCADE', + }) userMindmapRoles: UserMindmapRole[]; } diff --git a/BE/libs/entity/src/user.mindmap.role.ts b/BE/libs/entity/src/user.mindmap.role.ts index f5e17f35..19ffce12 100644 --- a/BE/libs/entity/src/user.mindmap.role.ts +++ b/BE/libs/entity/src/user.mindmap.role.ts @@ -8,11 +8,11 @@ export class UserMindmapRole { @PrimaryGeneratedColumn() id: number; - @ManyToOne(() => User, (user) => user.userMindmapRoles, { onDelete: 'CASCADE', nullable: false }) + @ManyToOne(() => User, (user) => user.userMindmapRoles, { nullable: false }) @JoinColumn({ name: 'user_id' }) user: User; - @ManyToOne(() => Mindmap, (mindmap) => mindmap.userMindmapRoles, { onDelete: 'CASCADE', nullable: false }) + @ManyToOne(() => Mindmap, (mindmap) => mindmap.userMindmapRoles, { nullable: false }) @JoinColumn({ name: 'mindmap_id' }) mindmap: Mindmap; @@ -20,5 +20,5 @@ export class UserMindmapRole { role: Role; @DeleteDateColumn() - deleteAt: Date | null; + deletedAt: Date | null; }