Merge pull request #269 from SyncrowIOT/feat/fix-delete-propagation

This commit is contained in:
hannathkadher
2025-02-26 16:03:44 +04:00
committed by GitHub
2 changed files with 2 additions and 3 deletions

View File

@ -22,7 +22,6 @@ export class PropogateDeleteSpaceModelHandler
const { spaceModel, queryRunner } = command.param; const { spaceModel, queryRunner } = command.param;
try { try {
await queryRunner.connect();
await queryRunner.startTransaction(); await queryRunner.startTransaction();
const spaces = await this.spaceRepository.find({ const spaces = await this.spaceRepository.find({
where: { where: {
@ -43,6 +42,7 @@ export class PropogateDeleteSpaceModelHandler
); );
} }
} }
await queryRunner.commitTransaction();
} catch (error) { } catch (error) {
await queryRunner.rollbackTransaction(); await queryRunner.rollbackTransaction();
this.logger.error( this.logger.error(

View File

@ -295,6 +295,7 @@ export class SpaceModelService {
{ uuid: param.spaceModelUuid }, { uuid: param.spaceModelUuid },
{ disabled: true }, { disabled: true },
); );
await queryRunner.commitTransaction();
await this.commandBus.execute( await this.commandBus.execute(
new PropogateDeleteSpaceModelCommand({ new PropogateDeleteSpaceModelCommand({
@ -303,8 +304,6 @@ export class SpaceModelService {
}), }),
); );
await queryRunner.commitTransaction();
return new SuccessResponseDto({ return new SuccessResponseDto({
message: `SpaceModel with UUID ${param.spaceModelUuid} deleted successfully.`, message: `SpaceModel with UUID ${param.spaceModelUuid} deleted successfully.`,
statusCode: HttpStatus.OK, statusCode: HttpStatus.OK,