mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-15 18:27:05 +00:00
Merge pull request #44 from SyncrowIOT/fix-some-issues
Refactor code to remove duplicate code and improve readability
This commit is contained in:
@ -103,7 +103,6 @@ export class DeviceService {
|
||||
const devicesData = await Promise.all(
|
||||
devices.map(async (device) => {
|
||||
return {
|
||||
uuid: device.uuid,
|
||||
haveRoom: device.spaceDevice ? true : false,
|
||||
productUuid: device.productDevice.uuid,
|
||||
productType: device.productDevice.prodType,
|
||||
@ -111,6 +110,7 @@ export class DeviceService {
|
||||
...(await this.getDeviceDetailsByDeviceIdTuya(
|
||||
device.deviceTuyaUuid,
|
||||
)),
|
||||
uuid: device.uuid,
|
||||
} as GetDeviceDetailsInterface;
|
||||
}),
|
||||
);
|
||||
@ -149,7 +149,6 @@ export class DeviceService {
|
||||
const devicesData = await Promise.all(
|
||||
devices.map(async (device) => {
|
||||
return {
|
||||
uuid: device.uuid,
|
||||
haveRoom: device.spaceDevice ? true : false,
|
||||
productUuid: device.productDevice.uuid,
|
||||
productType: device.productDevice.prodType,
|
||||
@ -157,6 +156,7 @@ export class DeviceService {
|
||||
...(await this.getDeviceDetailsByDeviceIdTuya(
|
||||
device.deviceTuyaUuid,
|
||||
)),
|
||||
uuid: device.uuid,
|
||||
} as GetDeviceDetailsInterface;
|
||||
}),
|
||||
);
|
||||
|
@ -303,8 +303,6 @@ export class UnitService {
|
||||
type: updatedUnit.spaceType.type,
|
||||
};
|
||||
} catch (err) {
|
||||
console.log('err', err);
|
||||
|
||||
if (err instanceof BadRequestException) {
|
||||
throw err;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user