|
|
|
@ -1034,8 +1034,6 @@ exports.mastrerList = async (req, reply) => {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//const moment = require('moment'); // For time calculations
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.getMasterSlaveSummary = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
@ -1660,6 +1658,7 @@ exports.getMasterSlaveSummary = async (req, reply) => {
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.getIotDataByCustomer = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
|
const { customerId } = req.params;
|
|
|
|
@ -1701,7 +1700,7 @@ exports.getIotDataByCustomer = async (req, reply) => {
|
|
|
|
|
const connectedSlaves = sensors.filter(sensor => sensor.connected_to?.trim() === hardwareId);
|
|
|
|
|
|
|
|
|
|
// Enrich tanks
|
|
|
|
|
const tanks = connectedSlaves.map(slave => {
|
|
|
|
|
let tanks = connectedSlaves.map(slave => {
|
|
|
|
|
const slaveId = slave.hardwareId?.trim();
|
|
|
|
|
const matchedTank = latestRecord.tanks.find(tank => tank.tankhardwareId === slaveId);
|
|
|
|
|
|
|
|
|
@ -1723,6 +1722,9 @@ exports.getIotDataByCustomer = async (req, reply) => {
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// ✅ Remove the first tank
|
|
|
|
|
tanks = tanks.slice(1);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
hardwareId,
|
|
|
|
|
message,
|
|
|
|
|