mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-27 23:14:54 +00:00
removed duplicated code
This commit is contained in:
@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user