From 5d7b087ba2cb403aec76b2dceaa64b07fc3e30b0 Mon Sep 17 00:00:00 2001 From: varun Date: Tue, 24 Jan 2023 23:29:25 -0500 Subject: [PATCH] made changes in createcontrollers --- src/controllers/createConnectionController.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/controllers/createConnectionController.js b/src/controllers/createConnectionController.js index 59b55167..f3e6fc80 100644 --- a/src/controllers/createConnectionController.js +++ b/src/controllers/createConnectionController.js @@ -15,11 +15,10 @@ exports.createConnections = async (req, body) => { var tankname = req.body.source; const tankInfo = await Tank.findOne({ tankName: tankname.toString() }) - const updateData = req.body; - console.log(updateData.inputConnections); - if (updateData.source) tankInfo.connections.source = updateData.source; - if (updateData.inputConnections) tankInfo.connections.inputConnections = updateData.inputConnections; - if (updateData.outputConnections) tankInfo.connections.outputConnections = updateData.outputConnections; + const usertobeInserted = req.body; + if (usertobeInserted.source) tankInfo.connections.source = usertobeInserted.source; + if (usertobeInserted.inputConnections) tankInfo.connections.inputConnections = usertobeInserted.inputConnections; + if (usertobeInserted.outputConnections) tankInfo.connections.outputConnections = usertobeInserted.outputConnections; const tank_connections = await tankInfo.save(); return tank_connections; } catch (err) {