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