Refactor getDevicesInstructionStatus method for improved readability

This commit is contained in:
faris Aljohari
2024-03-25 14:36:31 +03:00
parent 6c02f60f28
commit 46e7fc4260

View File

@ -381,12 +381,18 @@ export class DeviceService {
}
async getDevicesInstructionStatus(deviceId: string) {
try {
const response = await this.getDevicesInstructionStatusTuya(deviceId);
const deviceStatus = await this.getDevicesInstructionStatusTuya(deviceId);
const productId: string = await this.getProductIdByDeviceId(deviceId);
const productType: string =
await this.getProductTypeByProductId(productId);
return {
result: response.result,
success: response.success,
msg: response.msg,
result: {
productId: productId,
productType: productType,
status: deviceStatus.result[0].status,
},
success: deviceStatus.success,
msg: deviceStatus.msg,
};
} catch (error) {
throw new HttpException(