mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-16 02:36:19 +00:00
Merge branch 'dev' of https://github.com/SyncrowIOT/backend into feat/link-space-to-space-model
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import { TuyaService } from '@app/common/integrations/tuya/services/tuya.service';
|
||||
|
||||
import { HttpException, HttpStatus, Injectable } from '@nestjs/common';
|
||||
import { GetDeviceDetailsInterface } from 'src/device/interfaces/get.device.interface';
|
||||
import { GetSpaceParam } from '../dtos';
|
||||
@ -25,6 +26,12 @@ export class SpaceDeviceService {
|
||||
spaceUuid,
|
||||
);
|
||||
|
||||
if (!Array.isArray(space.devices)) {
|
||||
throw new HttpException(
|
||||
'The space does not contain any devices or the devices property is invalid.',
|
||||
HttpStatus.BAD_REQUEST,
|
||||
);
|
||||
}
|
||||
const safeFetch = async (device: any) => {
|
||||
try {
|
||||
const tuyaDetails = await this.getDeviceDetailsByDeviceIdTuya(
|
||||
@ -42,7 +49,7 @@ export class SpaceDeviceService {
|
||||
};
|
||||
} catch (error) {
|
||||
console.warn(
|
||||
`Skipping device with deviceTuyaUuid: ${device.deviceTuyaUuid} due to error.`,
|
||||
`Skipping device with deviceTuyaUuid: ${device.deviceTuyaUuid} due to error. ${error}`,
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user