mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-15 10:25:23 +00:00
fixed delete bug
This commit is contained in:
@ -48,7 +48,10 @@ export class SpaceEntity extends AbstractEntity<SpaceDto> {
|
|||||||
@ManyToOne(() => SpaceEntity, (space) => space.children, { nullable: true })
|
@ManyToOne(() => SpaceEntity, (space) => space.children, { nullable: true })
|
||||||
parent: SpaceEntity;
|
parent: SpaceEntity;
|
||||||
|
|
||||||
@OneToMany(() => SpaceEntity, (space) => space.parent)
|
@OneToMany(() => SpaceEntity, (space) => space.parent, {
|
||||||
|
nullable: false,
|
||||||
|
onDelete: 'CASCADE',
|
||||||
|
})
|
||||||
children: SpaceEntity[];
|
children: SpaceEntity[];
|
||||||
|
|
||||||
@OneToMany(() => UserSpaceEntity, (userSpace) => userSpace.space)
|
@OneToMany(() => UserSpaceEntity, (userSpace) => userSpace.space)
|
||||||
|
@ -126,8 +126,8 @@ export class SpaceService {
|
|||||||
try {
|
try {
|
||||||
// First, check if the community exists
|
// First, check if the community exists
|
||||||
const space = await this.validateCommunityAndSpace(
|
const space = await this.validateCommunityAndSpace(
|
||||||
spaceUuid,
|
|
||||||
communityUuid,
|
communityUuid,
|
||||||
|
spaceUuid,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Delete the space
|
// Delete the space
|
||||||
|
Reference in New Issue
Block a user