mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-10 15:17:41 +00:00
added tag check
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user