mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 08:54:54 +00:00
disable space
This commit is contained in:
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user