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