ADD tank and add bore changes

master
Bhaskar 1 year ago
parent bfe7fda84b
commit 1506c839a2

@ -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;

@ -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,

@ -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" },

@ -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);

Loading…
Cancel
Save