mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 12:04:53 +00:00
Merge pull request #138 from SyncrowIOT/fix-vistor-devices-issue
fix visitor devices issue
This commit is contained in:
@ -499,17 +499,29 @@ export class VisitorPasswordService {
|
||||
});
|
||||
const devicesData = await Promise.all(
|
||||
devices?.map(async (device) => {
|
||||
return {
|
||||
productUuid: device.productDevice.uuid,
|
||||
productType: device.productDevice.prodType,
|
||||
...(await this.deviceService.getDeviceDetailsByDeviceIdTuya(
|
||||
device.deviceTuyaUuid,
|
||||
)),
|
||||
uuid: device.uuid,
|
||||
} as GetDeviceDetailsInterface;
|
||||
try {
|
||||
const deviceDetails =
|
||||
await this.deviceService.getDeviceDetailsByDeviceIdTuya(
|
||||
device.deviceTuyaUuid,
|
||||
);
|
||||
return {
|
||||
productUuid: device.productDevice.uuid,
|
||||
productType: device.productDevice.prodType,
|
||||
...deviceDetails,
|
||||
uuid: device.uuid,
|
||||
} as GetDeviceDetailsInterface;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
`Error fetching details for device ${device.deviceTuyaUuid}:`,
|
||||
error,
|
||||
);
|
||||
// Return null or a specific value to indicate the error
|
||||
return null;
|
||||
}
|
||||
}),
|
||||
);
|
||||
return devicesData;
|
||||
// Filter out null values to only include successful device data
|
||||
return devicesData.filter((deviceData) => deviceData !== null);
|
||||
}
|
||||
|
||||
async addOnlineTemporaryPasswordOneTime(
|
||||
|
||||
Reference in New Issue
Block a user