removed duplicated code

This commit is contained in:
hannathkadher
2024-11-11 11:26:16 +04:00
parent af6aefca9c
commit c7c1a6ddc9

View File

@ -38,7 +38,6 @@ export class SpaceDeviceService {
productUuid: device.productDevice.uuid,
productType: device.productDevice.prodType,
isActive: device.isActive,
createdAt: device.createdAt,
updatedAt: device.updatedAt,
...tuyaDetails,
};
@ -93,18 +92,11 @@ export class SpaceDeviceService {
// Convert keys to camel case
const camelCaseResponse = convertKeysToCamelCase(tuyaDeviceDetails);
const product = await this.productRepository.findOne({
where: {
prodId: camelCaseResponse.productId,
},
});
// Exclude specific keys and add `productUuid`
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { uuid, ...rest } = camelCaseResponse;
return {
...rest,
productUuid: product?.uuid,
} as GetDeviceDetailsInterface;
} catch (error) {
throw new HttpException(