fixed delete propagation

This commit is contained in:
hannathkadher
2025-03-11 22:29:01 +04:00
parent 1403a670e3
commit 5c47a3195f
2 changed files with 18 additions and 0 deletions

View File

@ -49,6 +49,8 @@ export class PropogateUpdateSpaceModelHandler
await this.addSubspaceModel(subspaceModel, spaces);
} else if (subspaceModel.action === ModifyAction.DELETE) {
await this.deleteSubspaceModel(subspaceModel, spaces);
} else if (subspaceModel.action === ModifyAction.UPDATE) {
await this.updateSubspaceModel(subspaceModel);
}
}
}
@ -152,6 +154,15 @@ export class PropogateUpdateSpaceModelHandler
}
}
async updateSubspaceModel(subspaceModel: ISingleSubspaceModel) {
return this.subspaceRepository.update(
{
subSpaceModel: { uuid: subspaceModel.subspaceModel.uuid },
disabled: false,
},
{ subspaceName: subspaceModel.subspaceModel.subspaceName },
);
}
async updateSubspaceModels(
subspaceModels: UpdatedSubspaceModelPayload[],
queryRunner: QueryRunner,

View File

@ -36,6 +36,13 @@ export class PropogateDeleteSpaceModelHandler
for (const space of spaces) {
try {
await queryRunner.manager.update(
this.spaceRepository.target,
{ uuid: space.uuid },
{
spaceModel: null,
},
);
await this.spaceService.unlinkSpaceFromModel(space, queryRunner);
} catch (innerError) {
this.logger.error(