This commit is contained in:
hannathkadher
2025-01-27 12:54:46 +04:00
parent be60e02b99
commit 96bf8ed7f8
+1 -10
View File
@@ -47,7 +47,6 @@ export class TagModelService {
const tagEntitiesToCreate = tags.filter((tagDto) => tagDto.uuid === null);
const tagEntitiesToUpdate = tags.filter((tagDto) => tagDto.uuid !== null);
try {
const createdTags = await this.bulkSaveTags(
tagEntitiesToCreate,
@@ -137,7 +136,7 @@ export class TagModelService {
HttpStatus.NOT_FOUND,
);
}
if (subspaceModel && subspaceModel.spaceModel) {
await queryRunner.manager.update(
this.tagModelRepository.target,
@@ -278,7 +277,6 @@ export class TagModelService {
productUuid: tag.productUuid as string,
};
const newModel = await this.createTags(
[createTagDto],
queryRunner,
@@ -348,7 +346,6 @@ export class TagModelService {
],
});
// Remove tags that are marked for deletion
const filteredTagExists = tagExists.filter(
(existingTag) =>
@@ -357,7 +354,6 @@ export class TagModelService {
),
);
// If any tags remain, throw an exception
if (filteredTagExists.length > 0) {
throw new HttpException(
@@ -365,7 +361,6 @@ export class TagModelService {
HttpStatus.CONFLICT,
);
}
} catch (error) {
if (error instanceof HttpException) {
throw error;
@@ -487,20 +482,16 @@ export class TagModelService {
subspaceModels: ModifySubspaceModelDto[],
): ModifyTagModelDto[] {
if (!subspaceModels || subspaceModels.length === 0) {
return spaceTags;
}
const spaceTagsToDelete = spaceTags.filter(
(tag) => tag.action === 'delete',
);
const tagsToAdd = subspaceModels.flatMap(
(subspace) => subspace.tags?.filter((tag) => tag.action === 'add') || [],
);
const commonTagUuids = new Set(
tagsToAdd