mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-11 15:48:09 +00:00
Merge pull request #293 from SyncrowIOT/remove-old-tag-flow-from-update-space
remove old tag flow
This commit is contained in:
@ -490,23 +490,16 @@ export class SpaceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const hasSubspace = updateSpaceDto.subspace?.length > 0;
|
const hasSubspace = updateSpaceDto.subspace?.length > 0;
|
||||||
const hasTags = updateSpaceDto.tags?.length > 0;
|
|
||||||
|
|
||||||
if (hasSubspace || hasTags) {
|
if (hasSubspace) {
|
||||||
space.spaceModel = null;
|
space.spaceModel = null;
|
||||||
await this.tagService.unlinkModels(space.tags, queryRunner);
|
|
||||||
await this.subSpaceService.unlinkModels(space.subspaces, queryRunner);
|
await this.subSpaceService.unlinkModels(space.subspaces, queryRunner);
|
||||||
}
|
}
|
||||||
await queryRunner.manager.save(space);
|
await queryRunner.manager.save(space);
|
||||||
|
|
||||||
if (hasSubspace) {
|
if (hasSubspace) {
|
||||||
const modifiedSubspaces = this.tagService.getModifiedSubspaces(
|
|
||||||
updateSpaceDto.tags,
|
|
||||||
updateSpaceDto.subspace,
|
|
||||||
);
|
|
||||||
|
|
||||||
await this.subSpaceService.modifySubSpace(
|
await this.subSpaceService.modifySubSpace(
|
||||||
modifiedSubspaces,
|
updateSpaceDto.subspace,
|
||||||
queryRunner,
|
queryRunner,
|
||||||
space,
|
space,
|
||||||
projectUuid,
|
projectUuid,
|
||||||
@ -514,18 +507,6 @@ export class SpaceService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasTags) {
|
|
||||||
const spaceTagsAfterMove = this.tagService.getSubspaceTagsToBeAdded(
|
|
||||||
updateSpaceDto.tags,
|
|
||||||
updateSpaceDto.subspace,
|
|
||||||
);
|
|
||||||
|
|
||||||
await this.tagService.modifyTags(
|
|
||||||
spaceTagsAfterMove,
|
|
||||||
queryRunner,
|
|
||||||
space,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (updateSpaceDto.tags) {
|
if (updateSpaceDto.tags) {
|
||||||
await this.spaceProductAllocationService.updateSpaceProductAllocations(
|
await this.spaceProductAllocationService.updateSpaceProductAllocations(
|
||||||
updateSpaceDto.tags,
|
updateSpaceDto.tags,
|
||||||
|
Reference in New Issue
Block a user