|
|
@ -32,11 +32,13 @@ console.log(req.params);
|
|
|
|
capacity: req.body.capacity,
|
|
|
|
capacity: req.body.capacity,
|
|
|
|
typeOfWater: req.body.typeOfWater,
|
|
|
|
typeOfWater: req.body.typeOfWater,
|
|
|
|
|
|
|
|
|
|
|
|
tankLocation:(req.body.tankLocation).toLowerCase(),
|
|
|
|
tankLocation:req.body.tankLocation.toLowerCase(),
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
//console.log( req.body.tankLocation.toLowerCase())
|
|
|
|
|
|
|
|
|
|
|
|
var tank_name = req.body.tankName
|
|
|
|
var tank_name = req.body.tankName
|
|
|
|
var tankLocation = req.body.tankLocation
|
|
|
|
var tankLocation = req.body.tankLocation.toLowerCase()
|
|
|
|
var i_tank = await Tank.findOne({ tankName: tank_name,customerId:customerId,tankLocation:tankLocation})
|
|
|
|
var i_tank = await Tank.findOne({ tankName: tank_name,customerId:customerId,tankLocation:tankLocation})
|
|
|
|
if(i_tank){
|
|
|
|
if(i_tank){
|
|
|
|
throw new Error('tankname already exists');
|
|
|
|
throw new Error('tankname already exists');
|
|
|
@ -56,6 +58,7 @@ console.log(req.params);
|
|
|
|
tank.typeOfWater = usertobeInserted.typeOfWater;
|
|
|
|
tank.typeOfWater = usertobeInserted.typeOfWater;
|
|
|
|
|
|
|
|
|
|
|
|
tank.tankLocation = (usertobeInserted.tankLocation).toLowerCase();
|
|
|
|
tank.tankLocation = (usertobeInserted.tankLocation).toLowerCase();
|
|
|
|
|
|
|
|
console.log((usertobeInserted.tankLocation).toLowerCase())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const insertedTank = await tank.save();
|
|
|
|
const insertedTank = await tank.save();
|
|
|
|