changes in connections

master
varun 1 year ago
parent 618322a968
commit 6ca372fed0

@ -510,11 +510,7 @@ exports.createConnections = async (req, body) => {
try {
const customerId = req.params.customerId;
const tankname = req.body.tankname;
const water_capacity = req.body.capacity;
const water_water_level = req.body.water_level
const motorId = req.body.motor_id
const motorStatus = req.body.motor_status
const motorStopStatus = req.body.motor_stop_status
const tankInfo = await Tank.findOne({ customerId: customerId.toString(), tankName: tankname });
const usertobeInserted = req.body;
tankInfo.connections.source = tankInfo.tankName;
@ -564,6 +560,7 @@ exports.createConnections = async (req, body) => {
if (sump_names.includes(tankname)) {
console.log(`${tankname} exists in ${sump_names}`);
} else {
const tank_info1 = await Tank.findOne({ customerId: customerId.toString(), tankName: tankname });
const tankConnections = await Tank.findOneAndUpdate(
{ customerId: customerId.toString(), tankName: tankName },
{
@ -574,10 +571,10 @@ exports.createConnections = async (req, body) => {
input_type: 'sump',
inputismotor: true || false,
motor_id: motorId || null,
water_level: water_water_level || null,
capacity: water_capacity || null,
motor_status: motorStatus || "0",
motor_stop_status: motorStopStatus || "1"
water_level: tank_info1.waterlevel || null,
capacity: tank_info1.capacity || null,
motor_status: data.motor_status || "1",
motor_stop_status: data.motor_stop_status || "1"
}],
},
},

Loading…
Cancel
Save