use query runner for space link

This commit is contained in:
hannathkadher
2024-12-25 11:46:24 +04:00
parent ba00a85910
commit f9fe209076
2 changed files with 43 additions and 8 deletions

View File

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