Add productUuid to response in getDeviceDetails method

This commit is contained in:
faris Aljohari
2024-04-28 10:40:09 +03:00
parent 307761c915
commit c376e69e67

View File

@ -239,11 +239,18 @@ export class DeviceService {
// Convert keys to camel case
const camelCaseResponse = convertKeysToCamelCase(response);
const deviceDetails = await this.deviceRepository.findOne({
where: {
deviceTuyaUuid: deviceId,
},
relations: ['productDevice'],
});
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { productName, productId, ...rest } = camelCaseResponse.result;
return {
...rest,
productUuid: deviceDetails.productDevice.uuid,
} as GetDeviceDetailsInterface;
} catch (error) {
throw new HttpException(