|
|
|
@ -67,8 +67,8 @@ console.log(req.params);
|
|
|
|
|
exports.updateTanksInfo = async (req, reply) => {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const customerId = req.params.customerId;
|
|
|
|
|
const tankName = req.params.tankName;
|
|
|
|
|
var customerId = req.params.customerId;
|
|
|
|
|
var tankName = req.query.tankName;
|
|
|
|
|
const tank = req.body;
|
|
|
|
|
const { ...updateData } = tank;
|
|
|
|
|
const update = await Tank.findOneAndUpdate({ tankName: tankName,customerId:customerId, }, updateData, { new: true });
|
|
|
|
@ -87,9 +87,9 @@ exports.updateTanksInfo = async (req, reply) => {
|
|
|
|
|
//delete selected tank
|
|
|
|
|
exports.deleteTanksInfo = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
|
const username = loginObject.user.username;
|
|
|
|
|
const tankName = req.params.tankName;
|
|
|
|
|
const tank = await Tank.findOneAndDelete({ tankName: tankName,userName:username });
|
|
|
|
|
var customerId = req.params.customerId;
|
|
|
|
|
var tankName = req.query.tankName;
|
|
|
|
|
const tank = await Tank.findOneAndDelete({ tankName: tankName,customerId:customerId });
|
|
|
|
|
|
|
|
|
|
reply.send({ status_code: 200, data: tank});
|
|
|
|
|
// return tank;
|
|
|
|
@ -101,7 +101,7 @@ exports.deleteTanksInfo = async (req, reply) => {
|
|
|
|
|
//get tanks data by passing username
|
|
|
|
|
exports.getTank = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
|
await Tank.find({userName: req.query.userName})
|
|
|
|
|
await Tank.find({customerId: req.query.customerId})
|
|
|
|
|
.exec()
|
|
|
|
|
.then((docs) => {
|
|
|
|
|
reply.send({ status_code: 200, data: docs, count: docs.length });
|
|
|
|
|