mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 10:44:55 +00:00
use query runner for space link
This commit is contained in:
@ -90,6 +90,7 @@ export class SpaceService {
|
||||
parent.uuid,
|
||||
newSpace.uuid,
|
||||
direction,
|
||||
queryRunner,
|
||||
)
|
||||
: Promise.resolve(),
|
||||
subspaces?.length
|
||||
@ -361,6 +362,34 @@ export class SpaceService {
|
||||
}
|
||||
}
|
||||
|
||||
async deleteSpace(params: GetSpaceParam) {
|
||||
try {
|
||||
const { communityUuid, spaceUuid, projectUuid } = params;
|
||||
const space =
|
||||
await this.validationService.validateSpaceWithinCommunityAndProject(
|
||||
communityUuid,
|
||||
projectUuid,
|
||||
spaceUuid,
|
||||
);
|
||||
const spaces = await this.spaceRepository.find({
|
||||
where: { parent: { uuid: spaceUuid }, disabled: false },
|
||||
relations: ['parent', 'children'], // Include parent and children relations
|
||||
});
|
||||
console.log(spaces);
|
||||
// space.disabled = true;
|
||||
await this.spaceRepository.update({ uuid: space.uuid }, space);
|
||||
} catch (error) {
|
||||
if (error instanceof HttpException) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
throw new HttpException(
|
||||
'An error occurred while deleting the space',
|
||||
HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private updateSpaceProperties(
|
||||
space: SpaceEntity,
|
||||
updateSpaceDto: UpdateSpaceDto,
|
||||
|
||||
Reference in New Issue
Block a user