tern off data procedure

This commit is contained in:
faris Aljohari
2025-06-23 07:02:23 -06:00
parent 75d03366c2
commit c8d691b380

View File

@ -245,30 +245,30 @@ export class DeviceStatusFirebaseService {
} }
} }
if ( // if (
addDeviceStatusDto.productType === ProductType.CPS || // addDeviceStatusDto.productType === ProductType.CPS ||
addDeviceStatusDto.productType === ProductType.WPS // addDeviceStatusDto.productType === ProductType.WPS
) { // ) {
const occupancyCodes = new Set([PresenceSensorEnum.PRESENCE_STATE]); // const occupancyCodes = new Set([PresenceSensorEnum.PRESENCE_STATE]);
const occupancyStatus = addDeviceStatusDto?.log?.properties?.find( // const occupancyStatus = addDeviceStatusDto?.log?.properties?.find(
(status) => occupancyCodes.has(status.code), // (status) => occupancyCodes.has(status.code),
); // );
if (occupancyStatus) { // if (occupancyStatus) {
await this.occupancyService.updateOccupancySensorHistoricalData( // await this.occupancyService.updateOccupancySensorHistoricalData(
addDeviceStatusDto.deviceUuid, // addDeviceStatusDto.deviceUuid,
); // );
await this.occupancyService.updateOccupancySensorHistoricalDurationData( // await this.occupancyService.updateOccupancySensorHistoricalDurationData(
addDeviceStatusDto.deviceUuid, // addDeviceStatusDto.deviceUuid,
); // );
} // }
} // }
if (addDeviceStatusDto.productType === ProductType.AQI) { // if (addDeviceStatusDto.productType === ProductType.AQI) {
await this.aqiDataService.updateAQISensorHistoricalData( // await this.aqiDataService.updateAQISensorHistoricalData(
addDeviceStatusDto.deviceUuid, // addDeviceStatusDto.deviceUuid,
); // );
} // }
// Return the updated data // Return the updated data
const snapshot: DataSnapshot = await get(dataRef); const snapshot: DataSnapshot = await get(dataRef);
return snapshot.val(); return snapshot.val();