mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 15:34:54 +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(
|
const devicesData = await Promise.all(
|
||||||
devices?.map(async (device) => {
|
devices?.map(async (device) => {
|
||||||
return {
|
try {
|
||||||
productUuid: device.productDevice.uuid,
|
const deviceDetails =
|
||||||
productType: device.productDevice.prodType,
|
await this.deviceService.getDeviceDetailsByDeviceIdTuya(
|
||||||
...(await this.deviceService.getDeviceDetailsByDeviceIdTuya(
|
device.deviceTuyaUuid,
|
||||||
device.deviceTuyaUuid,
|
);
|
||||||
)),
|
return {
|
||||||
uuid: device.uuid,
|
productUuid: device.productDevice.uuid,
|
||||||
} as GetDeviceDetailsInterface;
|
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(
|
async addOnlineTemporaryPasswordOneTime(
|
||||||
|
|||||||
Reference in New Issue
Block a user