changes in get connections

master
varun 1 year ago
parent a00a33c6a8
commit 09962b330c

@ -172,15 +172,13 @@ exports.deleteTanksInfo = async (req, reply) => {
exports.getConnectionsInfoOfParticularTank = async (req, reply) => { exports.getConnectionsInfoOfParticularTank = async (req, reply) => {
try { try {
const InstallerId = req.params.InstallerId; const customerId = req.params.customerId;
const customerId = req.body.customerId;
const tankName = req.body.tankName; const tankName = req.body.tankName;
const tankLocation = req.body.tankLocation.toLowerCase(); const tankLocation = req.body.tankLocation.toLowerCase();
console.log(customerId, tankName, tankLocation); console.log(customerId, tankName, tankLocation);
// Find the specific tank // Find the specific tank
const mainTank = await Tank.findOne({ const mainTank = await Tank.findOne({
InstallerId:InstallerId,
tankName: tankName, tankName: tankName,
customerId: customerId, customerId: customerId,
tankLocation: tankLocation tankLocation: tankLocation
@ -199,6 +197,7 @@ exports.getConnectionsInfoOfParticularTank = async (req, reply) => {
//get tanks data by passing username //get tanks data by passing username
exports.getTank = async (req, reply) => { exports.getTank = async (req, reply) => {
try { try {

@ -43,7 +43,7 @@ module.exports = function (fastify, opts, next) {
], ],
}, },
preHandler: fastify.auth([fastify.authenticate]), // preHandler: fastify.auth([fastify.authenticate]),
handler: tanksController.addTanks, handler: tanksController.addTanks,
// onResponse: (request, reply) => { // onResponse: (request, reply) => {
// validationHandler.sendPhoneVerificationCode(request, reply); // validationHandler.sendPhoneVerificationCode(request, reply);
@ -140,17 +140,17 @@ module.exports = function (fastify, opts, next) {
fastify.route({ fastify.route({
method: "PUT", method: "PUT",
url: "/api/getConnectionsInfoOfParticularTank/:InstallerId", url: "/api/getConnectionsInfoOfParticularTank/:customerId",
schema: { schema: {
tags: ["Tank"], tags: ["Tank"],
summary: "This is to get Connections Info Of ParticularTank", summary: "This is to get Connections Info Of ParticularTank",
params: { params: {
required: ["InstallerId"], required: ["customerId"],
type: "object", type: "object",
properties: { properties: {
InstallerId: { customerId: {
type: "string", type: "string",
description: "InstallerId", description: "customerId",
}, },
}, },
}, },
@ -159,7 +159,6 @@ module.exports = function (fastify, opts, next) {
type: "object", type: "object",
// required: ['phone'], // required: ['phone'],
properties: { properties: {
customerId: { type: "string", default: null },
tankName: {type: 'string'}, tankName: {type: 'string'},
tankLocation: { type: "string", default: null }, tankLocation: { type: "string", default: null },
@ -178,6 +177,7 @@ module.exports = function (fastify, opts, next) {
fastify.get("/api/getTanks", { fastify.get("/api/getTanks", {
schema: { schema: {
tags: ["Tank"], tags: ["Tank"],

Loading…
Cancel
Save