added tag check

This commit is contained in:
hannathkadher
2025-04-27 11:21:30 +04:00
parent 6de81333ce
commit ff731ceea0

View File

@ -163,6 +163,25 @@ export class DeviceCommissionService {
return;
}
const devices = await this.deviceRepository.find({
where: {
spaceDevice: space,
},
relations: ['productDevice', 'tag'],
});
if (devices.length > 0) {
devices.forEach((device) => {
if (device.tag.uuid === match.tag.uuid) {
console.error(
`Device with same tag already exists: ${device.tag.name}`,
);
failureCount.value++;
return;
}
});
}
const middlewareDevice = this.deviceRepository.create({
deviceTuyaUuid: rawDeviceId,
isActive: true,