From 17fd3f6bf0bfe10ab000635c23829487a39fe527 Mon Sep 17 00:00:00 2001 From: Bhaskar Date: Thu, 17 Apr 2025 13:12:24 +0530 Subject: [PATCH] changes --- src/controllers/installationController.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/controllers/installationController.js b/src/controllers/installationController.js index 8728187b..b174602c 100644 --- a/src/controllers/installationController.js +++ b/src/controllers/installationController.js @@ -1355,6 +1355,10 @@ exports.getMasterSlaveSummary = async (req, reply) => { const loraTime = slave.connected_lora_time || null; const loraDate = slave.connected_lora_date || null; + // Fetch masterName using the connected_to masterId + const master = masters.find(m => m.hardwareId === masterId); + const masterName = master ? master.masterName : 'Unknown'; + slaveMap[masterId].push({ hardwareId: slave.hardwareId, tankName: slave.tankName || null, @@ -1366,7 +1370,9 @@ exports.getMasterSlaveSummary = async (req, reply) => { typeOfWater: slave.typeOfWater || 'N/A', // Add 'typeOfWater' field lora_last_check_time: slave.connected_lora_date && slave.connected_lora_time ? `${slave.connected_lora_date} ${slave.connected_lora_time}` - : null // Add 'lora_last_check_time' field + : null, // Add 'lora_last_check_time' field + connected_to: slave.connected_to, // Add 'connected_to' field + masterName: masterName // Add 'masterName' field }); }