changes in connections

master
varun 1 year ago
parent 6ca372fed0
commit 783495fd02

@ -506,6 +506,7 @@ const fastify = require("fastify")({
// };
exports.createConnections = async (req, body) => {
try {
const customerId = req.params.customerId;
@ -560,7 +561,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 });
console.log(tankInfo,"areyyy")
const tankConnections = await Tank.findOneAndUpdate(
{ customerId: customerId.toString(), tankName: tankName },
{
@ -569,14 +570,16 @@ exports.createConnections = async (req, body) => {
$each: [{
inputConnections: tankname,
input_type: 'sump',
inputismotor: true || false,
motor_id: motorId || null,
water_level: tank_info1.waterlevel || null,
capacity: tank_info1.capacity || null,
motor_status: data.motor_status || "1",
inputismotor: data.outputismotor || false,
motor_id: data.motor_id || null,
water_level: tankInfo.waterlevel || null,
capacity: tankInfo.capacity || null,
motor_status: data.motor_status || "0",
motor_stop_status: data.motor_stop_status || "1"
}],
},
}], },
// 'connections.outputConnections': {
// $each: [{ outputConnections: tankname, output_type: 'overhead'}],
// },
},
},
{ new: true }
@ -587,12 +590,11 @@ exports.createConnections = async (req, body) => {
}
}
return tank_connections;
} catch (err) {
throw boom.boomify(err);
}
};
};

Loading…
Cancel
Save