mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-15 18:27:05 +00:00
fixed deleting subspace
This commit is contained in:
@ -211,6 +211,7 @@ export class SpaceModelService {
|
||||
);
|
||||
|
||||
if (dto.subspaceModels) {
|
||||
console.log(JSON.stringify(modifiedSubspaces));
|
||||
modifiedSubspaceModels =
|
||||
await this.subSpaceModelService.modifySubSpaceModels(
|
||||
modifiedSubspaces,
|
||||
|
@ -243,15 +243,19 @@ export class SubSpaceModelService {
|
||||
);
|
||||
|
||||
if (subspaceModel.tags?.length) {
|
||||
const modifyTagDtos = subspaceModel.tags.map((tag) => ({
|
||||
uuid: tag.uuid,
|
||||
action: ModifyAction.DELETE,
|
||||
}));
|
||||
await this.tagModelService.modifyTags(
|
||||
const modifyTagDtos: CreateTagModelDto[] = subspaceModel.tags.map(
|
||||
(tag) => ({
|
||||
uuid: tag.uuid,
|
||||
action: ModifyAction.ADD,
|
||||
tag: tag.tag,
|
||||
productUuid: tag.product.uuid,
|
||||
}),
|
||||
);
|
||||
await this.tagModelService.moveTags(
|
||||
modifyTagDtos,
|
||||
queryRunner,
|
||||
subspaceModel.spaceModel,
|
||||
null,
|
||||
subspaceModel,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -259,7 +263,7 @@ export class SubSpaceModelService {
|
||||
private async findOne(subspaceUuid: string): Promise<SubspaceModelEntity> {
|
||||
const subspace = await this.subspaceModelRepository.findOne({
|
||||
where: { uuid: subspaceUuid, disabled: false },
|
||||
relations: ['tags', 'spaceModel'],
|
||||
relations: ['tags', 'spaceModel', 'tags.product'],
|
||||
});
|
||||
if (!subspace) {
|
||||
throw new HttpException(
|
||||
|
Reference in New Issue
Block a user