disable space

This commit is contained in:
hannathkadher
2024-12-30 10:06:33 +04:00
parent 0d539883f1
commit 6a89a17ce9
17 changed files with 604 additions and 177 deletions

View File

@ -317,8 +317,8 @@ export class SpaceService {
if (hasSubspace) {
await this.subSpaceService.modifySubSpace(
updateSpaceDto.subspace,
space,
queryRunner,
space,
);
}
@ -353,6 +353,37 @@ export class SpaceService {
}
}
async unlinkSpaceFromModel(
space: SpaceEntity,
queryRunner: QueryRunner,
): Promise<void> {
try {
await queryRunner.manager.update(
this.spaceRepository.target,
{ uuid: space.uuid },
{
spaceModel: null,
},
);
// Unlink subspaces and tags if they exist
if (space.subspaces || space.tags) {
if (space.tags) {
await this.tagService.unlinkModels(space.tags, queryRunner);
}
if (space.subspaces) {
await this.subSpaceService.unlinkModels(space.subspaces, queryRunner);
}
}
} catch (error) {
throw new HttpException(
`Failed to unlink space model: ${error.message}`,
HttpStatus.INTERNAL_SERVER_ERROR,
);
}
}
private updateSpaceProperties(
space: SpaceEntity,
updateSpaceDto: UpdateSpaceDto,