diff --git a/src/controllers/installationController.js b/src/controllers/installationController.js index 2b20ad77..4f9a5908 100644 --- a/src/controllers/installationController.js +++ b/src/controllers/installationController.js @@ -1700,6 +1700,7 @@ exports.masterConnectedSlaveList = async (req, reply) => { try { const { connectedTo, customerId } = req.params; + if (!connectedTo) { return reply.status(400).send({ success: false, message: "connectedTo is required" }); } @@ -1730,7 +1731,7 @@ exports.masterConnectedSlaveList = async (req, reply) => { ).lean(); const masterTypeOfWater = tankDetails?.typeOfWater || null; - + console.log("masterTypeOfWater",masterTypeOfWater) // Step 3: Get slave tanks connected to master and belonging to this customer const slaveTanks = await Insensors.find({ connected_to: connectedTo, type: 'slave', customerId }).lean(); const slaveCount = slaveTanks.length; @@ -1772,6 +1773,7 @@ exports.masterConnectedSlaveList = async (req, reply) => { ...master, isMaster: true, tankLocation: tankDetails?.tankLocation || null, + product_status: master.product_status || 'pending', typeOfWater: masterTypeOfWater, tankHeight: null, masterName: masterOrderInfo.masterName, @@ -1896,6 +1898,7 @@ return { ...slave, isMaster: false, hardwareId: finalHardwareId, + product_status: slave.product_status || 'pending', tankHeight: matchingTankData?.tankHeight ?? null, typeOfWater: masterTypeOfWater === 'bore' ? 'bore' : (slave.typeOfWater || null), height: slaveTankMeta?.height || null,