diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index bb76689e..7cc0c534 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -172,15 +172,13 @@ exports.deleteTanksInfo = async (req, reply) => { exports.getConnectionsInfoOfParticularTank = async (req, reply) => { try { - const InstallerId = req.params.InstallerId; - const customerId = req.body.customerId; + const customerId = req.params.customerId; const tankName = req.body.tankName; const tankLocation = req.body.tankLocation.toLowerCase(); console.log(customerId, tankName, tankLocation); // Find the specific tank const mainTank = await Tank.findOne({ - InstallerId:InstallerId, tankName: tankName, customerId: customerId, tankLocation: tankLocation @@ -199,6 +197,7 @@ exports.getConnectionsInfoOfParticularTank = async (req, reply) => { + //get tanks data by passing username exports.getTank = async (req, reply) => { try { diff --git a/src/routes/tanksRoute.js b/src/routes/tanksRoute.js index 12293367..c7efa444 100644 --- a/src/routes/tanksRoute.js +++ b/src/routes/tanksRoute.js @@ -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); @@ -140,17 +140,17 @@ module.exports = function (fastify, opts, next) { fastify.route({ method: "PUT", - url: "/api/getConnectionsInfoOfParticularTank/:InstallerId", + url: "/api/getConnectionsInfoOfParticularTank/:customerId", schema: { tags: ["Tank"], summary: "This is to get Connections Info Of ParticularTank", params: { - required: ["InstallerId"], + required: ["customerId"], type: "object", properties: { - InstallerId: { + customerId: { type: "string", - description: "InstallerId", + description: "customerId", }, }, }, @@ -159,7 +159,6 @@ module.exports = function (fastify, opts, next) { type: "object", // required: ['phone'], properties: { - customerId: { type: "string", default: null }, tankName: {type: 'string'}, tankLocation: { type: "string", default: null }, @@ -176,6 +175,7 @@ module.exports = function (fastify, opts, next) { handler: tanksController.getConnectionsInfoOfParticularTank, }); + fastify.get("/api/getTanks", {