diff --git a/libs/common/src/modules/space/entities/space.entity.ts b/libs/common/src/modules/space/entities/space.entity.ts index 38d4c5e..8aa717a 100644 --- a/libs/common/src/modules/space/entities/space.entity.ts +++ b/libs/common/src/modules/space/entities/space.entity.ts @@ -48,7 +48,10 @@ export class SpaceEntity extends AbstractEntity { @ManyToOne(() => SpaceEntity, (space) => space.children, { nullable: true }) parent: SpaceEntity; - @OneToMany(() => SpaceEntity, (space) => space.parent) + @OneToMany(() => SpaceEntity, (space) => space.parent, { + nullable: false, + onDelete: 'CASCADE', + }) children: SpaceEntity[]; @OneToMany(() => UserSpaceEntity, (userSpace) => userSpace.space) diff --git a/src/space/services/space.service.ts b/src/space/services/space.service.ts index 44d27ba..6e3e600 100644 --- a/src/space/services/space.service.ts +++ b/src/space/services/space.service.ts @@ -126,8 +126,8 @@ export class SpaceService { try { // First, check if the community exists const space = await this.validateCommunityAndSpace( - spaceUuid, communityUuid, + spaceUuid, ); // Delete the space