dto clean up

This commit is contained in:
hannathkadher
2024-12-23 08:47:57 +04:00
parent 5d4f04611f
commit a623028d7b
3 changed files with 2 additions and 41 deletions
@@ -17,9 +17,6 @@ import { SpaceModelDto } from '@app/common/modules/space-model/dtos';
import { SpaceModelParam } from '../dtos/space-model-param';
import { ProjectService } from 'src/project/services';
import { ProjectEntity } from '@app/common/modules/project/entities';
import { IModifySubspaceModelInterface } from '../interfaces';
import { CommandBus } from '@nestjs/cqrs';
import { PropogateSubspaceCommand } from '../commands';
@Injectable()
export class SpaceModelService {
@@ -28,7 +25,6 @@ export class SpaceModelService {
private readonly spaceModelRepository: SpaceModelRepository,
private readonly projectService: ProjectService,
private readonly subSpaceModelService: SubSpaceModelService,
private commandBus: CommandBus,
) {}
async createSpaceModel(
@@ -136,13 +132,12 @@ export class SpaceModelService {
await queryRunner.startTransaction();
try {
const { modelName } = dto;
let updatedSubspaces: IModifySubspaceModelInterface;
if (modelName) spaceModel.modelName = modelName;
await queryRunner.manager.save(spaceModel);
if (dto.subspaceModels) {
updatedSubspaces = await this.subSpaceModelService.modifySubSpaceModels(
await this.subSpaceModelService.modifySubSpaceModels(
dto.subspaceModels,
spaceModel,
queryRunner,
@@ -151,12 +146,6 @@ export class SpaceModelService {
await queryRunner.commitTransaction();
if (updatedSubspaces) {
await this.commandBus.execute(
new PropogateSubspaceCommand(updatedSubspaces),
);
}
return new SuccessResponseDto({
message: 'SpaceModel updated successfully',
data: spaceModel,