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