made changes in add tanks added installer id

master
varun 1 year ago
parent bcaed8bac0
commit a01b4bdfc3

@ -91,8 +91,8 @@ exports.addTanks = async (req, reply) => {
const customerId = req.params.customerId; const InstallerId = req.params.InstallerId;
const { hardwareId, tankhardwareId,tankName,tankLocation } = req.body; const { customerId,hardwareId, tankhardwareId,tankName,tankLocation } = req.body;
// Check if the combination of hardwareId and tankhardwareId already exists // Check if the combination of hardwareId and tankhardwareId already exists
@ -109,6 +109,7 @@ exports.addTanks = async (req, reply) => {
} }
const tankData = { const tankData = {
InstallerId:InstallerId,
customerId: customerId, customerId: customerId,
hardwareId: hardwareId, hardwareId: hardwareId,
tankhardwareId: tankhardwareId, tankhardwareId: tankhardwareId,

@ -33,7 +33,7 @@ const RoleSchema = new Schema({ name: String });
const tanksSchema = new mongoose.Schema({ const tanksSchema = new mongoose.Schema({
hardwareId: { type: String }, hardwareId: { type: String },
InstallerId: { type: String, default: null },
tankhardwareId: { type: String }, tankhardwareId: { type: String },
hardwareId_type: { type: String }, hardwareId_type: { type: String },
hardwareId_company: { type: String }, hardwareId_company: { type: String },

@ -6,18 +6,18 @@ module.exports = function (fastify, opts, next) {
fastify.route({ fastify.route({
method: "POST", method: "POST",
url: "/api/addTanks/:customerId", url: "/api/addTanks/:InstallerId",
schema: { schema: {
tags: ["Tank"], tags: ["Tank"],
description: "This is for cretae New Tank", description: "This is for cretae New Tank",
summary: "This is for Create New Tank.", summary: "This is for Create New Tank.",
params: { params: {
required: ["customerId"], required: ["InstallerId"],
type: "object", type: "object",
properties: { properties: {
customerId: { InstallerId: {
type: "string", type: "string",
description: "customerId", description: "InstallerId",
}, },
}, },
}, },
@ -29,7 +29,7 @@ module.exports = function (fastify, opts, next) {
tankName: { type: "string" }, tankName: { type: "string" },
blockName: { type: "string"}, blockName: { type: "string"},
capacity: { type: "string" }, capacity: { type: "string" },
customerId: { type: "string" },
typeOfWater: { type: "string" }, typeOfWater: { type: "string" },
waterCapacityPerCm:{ type: "string" }, waterCapacityPerCm:{ type: "string" },
tankLocation: { type: "string" }, tankLocation: { type: "string" },

Loading…
Cancel
Save