motor action and added installerid in bore creation

master
varun 1 year ago
parent 9e9c1d4bf8
commit a2e0e0e8d8

@ -388,12 +388,13 @@ exports.addBores = async (req, reply) => {
try { try {
var customerId = req.params.customerId; var InstallerId = req.params.InstallerId;
//console.log(customerId); //console.log(customerId);
//const username = loginObject.user.username; //const username = loginObject.user.username;
boresData = { boresData = {
customerId:customerId, InstallerId:InstallerId,
customerId:req.body.customerId,
boreName: req.body.boreName, boreName: req.body.boreName,
capacity: req.body.capacity, capacity: req.body.capacity,
typeofwater: req.body.typeofwater, typeofwater: req.body.typeofwater,
@ -414,6 +415,9 @@ exports.addBores = async (req, reply) => {
if (checkFormEncoding.isUserFormUrlEncoded) { if (checkFormEncoding.isUserFormUrlEncoded) {
usertobeInserted = checkFormEncoding.bores; usertobeInserted = checkFormEncoding.bores;
console.log("thsi true url string"); console.log("thsi true url string");
bores.InstallerId = usertobeInserted.InstallerId
bores.customerId = usertobeInserted.customerId bores.customerId = usertobeInserted.customerId
bores.boreName = usertobeInserted.boreName; bores.boreName = usertobeInserted.boreName;
bores.capacity = usertobeInserted.capacity; bores.capacity = usertobeInserted.capacity;

@ -1097,7 +1097,7 @@ exports.motorAction = async (req, reply) => {
const newMotorData = new MotorData({ const newMotorData = new MotorData({
customerId: customerId, customerId: customerId,
motor_id: motor_id, motor_id: motorId,
start_instance_id: start_instance_id, start_instance_id: start_instance_id,
supplierTank: req.body.from, supplierTank: req.body.from,
receiverTank: req.body.to, receiverTank: req.body.to,

@ -76,7 +76,7 @@ const tankersbookingSchema = new mongoose.Schema({
const boreSchema = new mongoose.Schema({ const boreSchema = new mongoose.Schema({
customerId: { type: String, default: null }, customerId: { type: String, default: null },
InstallerId: { type: String, default: null },
boreName: { type: String, default: null }, boreName: { type: String, default: null },
capacity: { type: String, default: null }, capacity: { type: String, default: null },
typeofwater: { type: String, default: null }, typeofwater: { type: String, default: null },

@ -269,18 +269,18 @@ module.exports = function (fastify, opts, next) {
fastify.route({ fastify.route({
method: "POST", method: "POST",
url: "/api/addBores/:customerId", url: "/api/addBores/:InstallerId",
schema: { schema: {
tags: ["Tank"], tags: ["Tank"],
description: "This is to cretae New Bore", description: "This is to cretae New Bore",
summary: "This is to Create New Bore.", summary: "This is to Create New Bore.",
params: { params: {
required: ["customerId"], required: ["InstallerId"],
type: "object", type: "object",
properties: { properties: {
customerId: { InstallerId: {
type: "string", type: "string",
description: "customerId", description: "InstallerId",
}, },
}, },
}, },
@ -288,6 +288,7 @@ module.exports = function (fastify, opts, next) {
type: "object", type: "object",
properties: { properties: {
boreName: { type: "string" }, boreName: { type: "string" },
customerId: { type: "string" },
capacity: { type: "string" }, capacity: { type: "string" },
typeofwater: { type: "string" }, typeofwater: { type: "string" },
description: { type: "string" }, description: { type: "string" },

Loading…
Cancel
Save