mirror of
https://github.com/SyncrowIOT/backend.git
synced 2026-10-25 07:37:56 +00:00
Merge pull request #268 from SyncrowIOT:feat/fix-delete-propagation
Feat/fix-delete-propagation
This commit is contained in:
@@ -3,6 +3,9 @@
|
|||||||
/node_modules
|
/node_modules
|
||||||
/build
|
/build
|
||||||
|
|
||||||
|
#github
|
||||||
|
/.github
|
||||||
|
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
*.log
|
*.log
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import { SpaceModelEntity } from '@app/common/modules/space-model';
|
import { SpaceModelEntity } from '@app/common/modules/space-model';
|
||||||
|
import { QueryRunner } from 'typeorm';
|
||||||
|
|
||||||
export class PropogateDeleteSpaceModelCommand {
|
export class PropogateDeleteSpaceModelCommand {
|
||||||
constructor(
|
constructor(
|
||||||
public readonly param: {
|
public readonly param: {
|
||||||
spaceModel: SpaceModelEntity;
|
spaceModel: SpaceModelEntity;
|
||||||
|
queryRunner: QueryRunner;
|
||||||
},
|
},
|
||||||
) {}
|
) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ export class PropogateDeleteSpaceModelHandler
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
async execute(command: PropogateDeleteSpaceModelCommand): Promise<void> {
|
async execute(command: PropogateDeleteSpaceModelCommand): Promise<void> {
|
||||||
const { spaceModel } = command.param;
|
const { spaceModel, queryRunner } = command.param;
|
||||||
const queryRunner = this.dataSource.createQueryRunner();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await queryRunner.connect();
|
await queryRunner.connect();
|
||||||
|
|||||||
@@ -19,7 +19,10 @@ import { ProjectEntity } from '@app/common/modules/project/entities';
|
|||||||
import { TagModelService } from './tag-model.service';
|
import { TagModelService } from './tag-model.service';
|
||||||
import { BaseResponseDto } from '@app/common/dto/base.response.dto';
|
import { BaseResponseDto } from '@app/common/dto/base.response.dto';
|
||||||
import { CommandBus } from '@nestjs/cqrs';
|
import { CommandBus } from '@nestjs/cqrs';
|
||||||
import { PropogateUpdateSpaceModelCommand } from '../commands';
|
import {
|
||||||
|
PropogateDeleteSpaceModelCommand,
|
||||||
|
PropogateUpdateSpaceModelCommand,
|
||||||
|
} from '../commands';
|
||||||
import {
|
import {
|
||||||
ModifiedTagsModelPayload,
|
ModifiedTagsModelPayload,
|
||||||
ModifySubspaceModelPayload,
|
ModifySubspaceModelPayload,
|
||||||
@@ -293,6 +296,13 @@ export class SpaceModelService {
|
|||||||
{ disabled: true },
|
{ disabled: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await this.commandBus.execute(
|
||||||
|
new PropogateDeleteSpaceModelCommand({
|
||||||
|
spaceModel: spaceModel,
|
||||||
|
queryRunner,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
await queryRunner.commitTransaction();
|
await queryRunner.commitTransaction();
|
||||||
|
|
||||||
return new SuccessResponseDto({
|
return new SuccessResponseDto({
|
||||||
|
|||||||
Reference in New Issue
Block a user