diff --git a/src/controllers/tankersController.js b/src/controllers/tankersController.js index 8f4c1082..b1335bbb 100644 --- a/src/controllers/tankersController.js +++ b/src/controllers/tankersController.js @@ -388,13 +388,14 @@ exports.addBores = async (req, reply) => { try { - var InstallerId = req.params.InstallerId; + var customerId = req.params.customerId; //console.log(customerId); //const username = loginObject.user.username; boresData = { - InstallerId:InstallerId, - customerId:req.body.customerId, + // InstallerId:InstallerId, + // customerId:req.body.customerId, + customerId:customerId, boreName: req.body.boreName, capacity: req.body.capacity, typeofwater: req.body.typeofwater, @@ -416,7 +417,7 @@ exports.addBores = async (req, reply) => { usertobeInserted = checkFormEncoding.bores; console.log("thsi true url string"); - bores.InstallerId = usertobeInserted.InstallerId + // bores.InstallerId = usertobeInserted.InstallerId bores.customerId = usertobeInserted.customerId bores.boreName = usertobeInserted.boreName; diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 84737073..0ce4bfa6 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -88,11 +88,10 @@ async function deleteOldRecords() { exports.addTanks = async (req, reply) => { try { - const InstallerId = req.params.InstallerId; - const { customerId,hardwareId, tankhardwareId,tankName,tankLocation } = req.body; + const customerId = req.params.customerId; + const { hardwareId, tankhardwareId,tankName,tankLocation } = req.body; - // Check if the combination of hardwareId and tankhardwareId already exists const existingTank = await Tank.findOne({ customerId: customerId, hardwareId: hardwareId, @@ -106,7 +105,7 @@ exports.addTanks = async (req, reply) => { } const tankData = { - InstallerId:InstallerId, + // InstallerId:InstallerId, customerId: customerId, hardwareId: hardwareId, tankhardwareId: tankhardwareId, diff --git a/src/routes/tankersRoute.js b/src/routes/tankersRoute.js index 9640dbf5..2e5b00a5 100644 --- a/src/routes/tankersRoute.js +++ b/src/routes/tankersRoute.js @@ -269,18 +269,18 @@ module.exports = function (fastify, opts, next) { fastify.route({ method: "POST", - url: "/api/addBores/:InstallerId", + url: "/api/addBores/:customerId", schema: { tags: ["Install"], description: "This is to cretae New Bore", summary: "This is to Create New Bore.", params: { - required: ["InstallerId"], + // required: ["InstallerId"], type: "object", properties: { - InstallerId: { + customerId: { type: "string", - description: "InstallerId", + description: "customerId", }, }, }, @@ -288,7 +288,7 @@ module.exports = function (fastify, opts, next) { type: "object", properties: { boreName: { type: "string" }, - customerId: { type: "string" }, + // customerId: { type: "string" }, capacity: { type: "string" }, typeofwater: { type: "string" }, description: { type: "string" }, diff --git a/src/routes/tanksRoute.js b/src/routes/tanksRoute.js index f51c7fea..9ba0bb58 100644 --- a/src/routes/tanksRoute.js +++ b/src/routes/tanksRoute.js @@ -6,18 +6,18 @@ module.exports = function (fastify, opts, next) { fastify.route({ method: "POST", - url: "/api/addTanks/:InstallerId", + url: "/api/addTanks/:customerId", schema: { tags: ["Install"], description: "This is for cretae New Tank", summary: "This is for Create New Tank.", params: { - required: ["InstallerId"], + // required: ["InstallerId"], type: "object", properties: { - InstallerId: { + customerId: { type: "string", - description: "InstallerId", + description: "customerId", }, }, }, @@ -29,7 +29,7 @@ module.exports = function (fastify, opts, next) { tankName: { type: "string" }, blockName: { type: "string"}, capacity: { type: "string" }, - customerId: { type: "string" }, + // customerId: { type: "string" }, typeOfWater: { type: "string" }, waterCapacityPerCm:{ type: "string" }, tankLocation: { type: "string" }, @@ -43,7 +43,7 @@ module.exports = function (fastify, opts, next) { ], }, - // preHandler: fastify.auth([fastify.authenticate]), + preHandler: fastify.auth([fastify.authenticate]), handler: tanksController.addTanks, // onResponse: (request, reply) => { // validationHandler.sendPhoneVerificationCode(request, reply);