mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 17:44:54 +00:00
added tag check
This commit is contained in:
@ -163,6 +163,25 @@ export class DeviceCommissionService {
|
|||||||
return;
|
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({
|
const middlewareDevice = this.deviceRepository.create({
|
||||||
deviceTuyaUuid: rawDeviceId,
|
deviceTuyaUuid: rawDeviceId,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user