mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 22:24:55 +00:00
tag
This commit is contained in:
15
package-lock.json
generated
15
package-lock.json
generated
@ -6896,21 +6896,6 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
"node_modules/fsevents": {
|
|
||||||
"version": "2.3.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
|
||||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
|
||||||
"dev": true,
|
|
||||||
"hasInstallScript": true,
|
|
||||||
"license": "MIT",
|
|
||||||
"optional": true,
|
|
||||||
"os": [
|
|
||||||
"darwin"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/function-bind": {
|
"node_modules/function-bind": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||||
|
|||||||
@ -5,11 +5,7 @@ import {
|
|||||||
SpaceModelRepository,
|
SpaceModelRepository,
|
||||||
} from '@app/common/modules/space-model';
|
} from '@app/common/modules/space-model';
|
||||||
import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
|
import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
|
||||||
import {
|
import { CreateSpaceModelDto, UpdateSpaceModelDto } from '../dtos';
|
||||||
CreateSpaceModelDto,
|
|
||||||
CreateSubspaceModelDto,
|
|
||||||
UpdateSpaceModelDto,
|
|
||||||
} from '../dtos';
|
|
||||||
import { ProjectParam } from 'src/community/dtos';
|
import { ProjectParam } from 'src/community/dtos';
|
||||||
import { SuccessResponseDto } from '@app/common/dto/success.response.dto';
|
import { SuccessResponseDto } from '@app/common/dto/success.response.dto';
|
||||||
import { SubSpaceModelService } from './subspace/subspace-model.service';
|
import { SubSpaceModelService } from './subspace/subspace-model.service';
|
||||||
@ -58,7 +54,7 @@ export class SpaceModelService {
|
|||||||
const queryRunner = this.dataSource.createQueryRunner();
|
const queryRunner = this.dataSource.createQueryRunner();
|
||||||
await queryRunner.connect();
|
await queryRunner.connect();
|
||||||
await queryRunner.startTransaction();
|
await queryRunner.startTransaction();
|
||||||
|
console.log("c");
|
||||||
try {
|
try {
|
||||||
const project = await this.validateProject(params.projectUuid);
|
const project = await this.validateProject(params.projectUuid);
|
||||||
|
|
||||||
@ -106,12 +102,13 @@ export class SpaceModelService {
|
|||||||
statusCode: HttpStatus.CREATED,
|
statusCode: HttpStatus.CREATED,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log("jj");
|
||||||
await queryRunner.rollbackTransaction();
|
await queryRunner.rollbackTransaction();
|
||||||
|
|
||||||
const errorMessage =
|
const errorMessage =
|
||||||
error instanceof HttpException
|
error instanceof HttpException
|
||||||
? error.message
|
? error.message
|
||||||
: 'An unexpected error occurred';
|
: `An unexpected error occurred ${error.message}`;
|
||||||
const statusCode =
|
const statusCode =
|
||||||
error instanceof HttpException
|
error instanceof HttpException
|
||||||
? error.getStatus()
|
? error.getStatus()
|
||||||
|
|||||||
@ -53,19 +53,16 @@ export class SubSpaceModelService {
|
|||||||
subspaceEntities.push(subspaceModel);
|
subspaceEntities.push(subspaceModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save all subspaces in bulk
|
|
||||||
const savedSubspaces = await queryRunner.manager.save(subspaceEntities);
|
const savedSubspaces = await queryRunner.manager.save(subspaceEntities);
|
||||||
|
|
||||||
for (const [index, dto] of dtos.entries()) {
|
for (const [index, dto] of dtos.entries()) {
|
||||||
const subspaceModel = savedSubspaces[index];
|
const subspaceModel = savedSubspaces[index];
|
||||||
|
|
||||||
// Process tags for this subspace
|
|
||||||
const processedTags = await this.tagService.processTags(
|
const processedTags = await this.tagService.processTags(
|
||||||
dto.tags,
|
dto.tags,
|
||||||
spaceModel.project.uuid,
|
spaceModel.project.uuid,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Create Product Allocations for Subspace Model
|
|
||||||
await this.createSubspaceProductAllocations(subspaceModel, processedTags);
|
await this.createSubspaceProductAllocations(subspaceModel, processedTags);
|
||||||
}
|
}
|
||||||
return savedSubspaces;
|
return savedSubspaces;
|
||||||
|
|||||||
Reference in New Issue
Block a user