removed old tags

This commit is contained in:
hannathkadher
2025-03-10 10:57:27 +04:00
parent 3bbc39734b
commit d1a976d152
7 changed files with 42 additions and 133 deletions

View File

@ -81,24 +81,6 @@ export class SubspaceDeviceService {
const subspace = await this.findSubspace(subSpaceUuid);
const device = await this.findDevice(deviceUuid);
if (device.tag?.subspace?.uuid !== subspace.uuid) {
await this.tagRepository.update(
{ uuid: device.tag.uuid },
{ subspace, space: null },
);
}
if (!device.tag) {
const tag = this.tagRepository.create({
tag: `Tag ${this.findNextTag()}`,
product: device.productDevice,
subspace: subspace,
device: device,
});
await this.tagRepository.save(tag);
device.tag = tag;
}
device.subspace = subspace;
const newDevice = await this.deviceRepository.save(device);
@ -140,26 +122,6 @@ export class SubspaceDeviceService {
);
}
if (device.tag?.subspace !== null) {
await this.tagRepository.update(
{ uuid: device.tag.uuid },
{ subspace: null, space: device.spaceDevice },
);
}
if (!device.tag) {
const tag = this.tagRepository.create({
tag: `Tag ${this.findNextTag()}`,
product: device.productDevice,
subspace: null,
space: device.spaceDevice,
device: device,
});
await this.tagRepository.save(tag);
device.tag = tag;
}
device.subspace = null;
const updatedDevice = await this.deviceRepository.save(device);