fixed deleting subspace

This commit is contained in:
hannathkadher
2025-01-30 21:52:59 +04:00
parent 11faa52283
commit f77d52b6be
2 changed files with 12 additions and 7 deletions

View File

@ -211,6 +211,7 @@ export class SpaceModelService {
);
if (dto.subspaceModels) {
console.log(JSON.stringify(modifiedSubspaces));
modifiedSubspaceModels =
await this.subSpaceModelService.modifySubSpaceModels(
modifiedSubspaces,

View File

@ -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(