mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 10:24:53 +00:00
fixed commission device
This commit is contained in:
@ -83,6 +83,7 @@ export class DeviceCommissionService {
|
|||||||
const tagName = row['Tag']?.trim();
|
const tagName = row['Tag']?.trim();
|
||||||
const productName = row['Product Name']?.trim();
|
const productName = row['Product Name']?.trim();
|
||||||
const projectId = param.projectUuid;
|
const projectId = param.projectUuid;
|
||||||
|
let deviceName: string;
|
||||||
|
|
||||||
if (!rawDeviceId) {
|
if (!rawDeviceId) {
|
||||||
console.error('Missing Device ID in row:', row);
|
console.error('Missing Device ID in row:', row);
|
||||||
@ -97,6 +98,10 @@ export class DeviceCommissionService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (device && typeof device === 'object' && 'name' in device) {
|
||||||
|
deviceName = (device as any).name || '';
|
||||||
|
}
|
||||||
|
|
||||||
const community = await this.communityRepository.findOne({
|
const community = await this.communityRepository.findOne({
|
||||||
where: { uuid: communityId, project: { uuid: projectId } },
|
where: { uuid: communityId, project: { uuid: projectId } },
|
||||||
});
|
});
|
||||||
@ -189,6 +194,7 @@ export class DeviceCommissionService {
|
|||||||
subspace: subspace || null,
|
subspace: subspace || null,
|
||||||
productDevice: match.product,
|
productDevice: match.product,
|
||||||
tag: match.tag,
|
tag: match.tag,
|
||||||
|
name: deviceName ?? '',
|
||||||
});
|
});
|
||||||
|
|
||||||
await this.deviceRepository.save(middlewareDevice);
|
await this.deviceRepository.save(middlewareDevice);
|
||||||
@ -198,6 +204,9 @@ export class DeviceCommissionService {
|
|||||||
tuyaSpaceId,
|
tuyaSpaceId,
|
||||||
);
|
);
|
||||||
successCount.value++;
|
successCount.value++;
|
||||||
|
console.log(
|
||||||
|
`Device ${rawDeviceId} successfully processed and transferred to Tuya space ${tuyaSpaceId}`,
|
||||||
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
failureCount.value++;
|
failureCount.value++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,7 +40,6 @@ export class DisableSpaceHandler
|
|||||||
relations: [
|
relations: [
|
||||||
'subspaces',
|
'subspaces',
|
||||||
'parent',
|
'parent',
|
||||||
'tags',
|
|
||||||
'devices',
|
'devices',
|
||||||
'outgoingConnections',
|
'outgoingConnections',
|
||||||
'incomingConnections',
|
'incomingConnections',
|
||||||
|
|||||||
Reference in New Issue
Block a user