fixed delete bug

This commit is contained in:
hannathkadher
2024-11-21 16:11:53 +04:00
parent 67c5ebaa41
commit 221fd47e2e
2 changed files with 5 additions and 2 deletions

View File

@ -48,7 +48,10 @@ export class SpaceEntity extends AbstractEntity<SpaceDto> {
@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)

View File

@ -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