|
|
|
@ -1,4 +1,6 @@
|
|
|
|
|
const Tank = require("../models/tanks");
|
|
|
|
|
//const Tank = require("../models/tanks");
|
|
|
|
|
const { Tank, MotorData } = require('../models/tanks')
|
|
|
|
|
|
|
|
|
|
const User = require("../models/User");
|
|
|
|
|
const boom = require("boom");
|
|
|
|
|
const fastify = require("fastify")({
|
|
|
|
@ -326,6 +328,35 @@ exports.motorAction = async (req, reply) => {
|
|
|
|
|
}, 2000);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
console.log(customerId,req.body.from,req.body.from_type,receiver_tank,req.body.to_type,)
|
|
|
|
|
motorData = {
|
|
|
|
|
|
|
|
|
|
customerId:customerId,
|
|
|
|
|
supplierTank : req.body.from,
|
|
|
|
|
supplier_type: req.body.from_type,
|
|
|
|
|
receiverTank: receiver_tank,
|
|
|
|
|
receiver_type: req.body.to_type,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
var motorData = new MotorData(motorData);
|
|
|
|
|
|
|
|
|
|
checkFormEncoding = isUserFormUrlEncoded(req);
|
|
|
|
|
if (checkFormEncoding.isUserFormUrlEncoded) {
|
|
|
|
|
usertobeInserted = checkFormEncoding.motorData;
|
|
|
|
|
console.log("thsi true url string");
|
|
|
|
|
motorData.customerId = customerId;
|
|
|
|
|
motorData.supplierTank = req.body.from;
|
|
|
|
|
motorData.receiverTank = receiver_tank;
|
|
|
|
|
motorData.supplier_type = req.body.from_type;
|
|
|
|
|
motorData.receiver_type = req.body.to_type;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
const motor_data = await motorData.save();
|
|
|
|
|
reply.send({ status_code: 200, data: motor_data });
|
|
|
|
|
return motor_data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|