mirror of
https://github.com/SyncrowIOT/backend.git
synced 2026-10-24 11:57:54 +00:00
tag
This commit is contained in:
@@ -5,11 +5,7 @@ import {
|
||||
SpaceModelRepository,
|
||||
} from '@app/common/modules/space-model';
|
||||
import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
|
||||
import {
|
||||
CreateSpaceModelDto,
|
||||
CreateSubspaceModelDto,
|
||||
UpdateSpaceModelDto,
|
||||
} from '../dtos';
|
||||
import { CreateSpaceModelDto, UpdateSpaceModelDto } from '../dtos';
|
||||
import { ProjectParam } from 'src/community/dtos';
|
||||
import { SuccessResponseDto } from '@app/common/dto/success.response.dto';
|
||||
import { SubSpaceModelService } from './subspace/subspace-model.service';
|
||||
@@ -58,7 +54,7 @@ export class SpaceModelService {
|
||||
const queryRunner = this.dataSource.createQueryRunner();
|
||||
await queryRunner.connect();
|
||||
await queryRunner.startTransaction();
|
||||
|
||||
console.log("c");
|
||||
try {
|
||||
const project = await this.validateProject(params.projectUuid);
|
||||
|
||||
@@ -106,12 +102,13 @@ export class SpaceModelService {
|
||||
statusCode: HttpStatus.CREATED,
|
||||
});
|
||||
} catch (error) {
|
||||
console.log("jj");
|
||||
await queryRunner.rollbackTransaction();
|
||||
|
||||
const errorMessage =
|
||||
error instanceof HttpException
|
||||
? error.message
|
||||
: 'An unexpected error occurred';
|
||||
: `An unexpected error occurred ${error.message}`;
|
||||
const statusCode =
|
||||
error instanceof HttpException
|
||||
? error.getStatus()
|
||||
|
||||
@@ -53,19 +53,16 @@ export class SubSpaceModelService {
|
||||
subspaceEntities.push(subspaceModel);
|
||||
}
|
||||
|
||||
// Save all subspaces in bulk
|
||||
const savedSubspaces = await queryRunner.manager.save(subspaceEntities);
|
||||
|
||||
for (const [index, dto] of dtos.entries()) {
|
||||
const subspaceModel = savedSubspaces[index];
|
||||
|
||||
// Process tags for this subspace
|
||||
const processedTags = await this.tagService.processTags(
|
||||
dto.tags,
|
||||
spaceModel.project.uuid,
|
||||
);
|
||||
|
||||
// Create Product Allocations for Subspace Model
|
||||
await this.createSubspaceProductAllocations(subspaceModel, processedTags);
|
||||
}
|
||||
return savedSubspaces;
|
||||
|
||||
Reference in New Issue
Block a user