mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-27 11:14:55 +00:00
removed old tags
This commit is contained in:
@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user