mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-27 02:44:55 +00:00
Merge branch 'dev' into feat/project-tag
This commit is contained in:
@ -1,9 +1,11 @@
|
||||
import { SpaceModelEntity } from '@app/common/modules/space-model';
|
||||
import { QueryRunner } from 'typeorm';
|
||||
|
||||
export class PropogateDeleteSpaceModelCommand {
|
||||
constructor(
|
||||
public readonly param: {
|
||||
spaceModel: SpaceModelEntity;
|
||||
queryRunner: QueryRunner;
|
||||
},
|
||||
) {}
|
||||
}
|
||||
|
||||
@ -19,8 +19,7 @@ export class PropogateDeleteSpaceModelHandler
|
||||
) {}
|
||||
|
||||
async execute(command: PropogateDeleteSpaceModelCommand): Promise<void> {
|
||||
const { spaceModel } = command.param;
|
||||
const queryRunner = this.dataSource.createQueryRunner();
|
||||
const { spaceModel, queryRunner } = command.param;
|
||||
|
||||
try {
|
||||
await queryRunner.connect();
|
||||
|
||||
@ -25,6 +25,7 @@ import { BaseResponseDto } from '@app/common/dto/base.response.dto';
|
||||
import { CommandBus } from '@nestjs/cqrs';
|
||||
import { ProcessTagDto } from 'src/tags/dtos';
|
||||
import { SpaceModelProductAllocationService } from './space-model-product-allocation.service';
|
||||
import { PropogateDeleteSpaceModelCommand } from '../commands';
|
||||
import {
|
||||
SpaceProductAllocationRepository,
|
||||
SpaceRepository,
|
||||
@ -283,6 +284,13 @@ export class SpaceModelService {
|
||||
{ disabled: true },
|
||||
);
|
||||
|
||||
await this.commandBus.execute(
|
||||
new PropogateDeleteSpaceModelCommand({
|
||||
spaceModel: spaceModel,
|
||||
queryRunner,
|
||||
}),
|
||||
);
|
||||
|
||||
await queryRunner.commitTransaction();
|
||||
|
||||
return new SuccessResponseDto({
|
||||
|
||||
Reference in New Issue
Block a user