diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 25a490ad..813e4f56 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -91,8 +91,8 @@ exports.addTanks = async (req, reply) => { - const customerId = req.params.customerId; - const { hardwareId, tankhardwareId,tankName,tankLocation } = req.body; + const InstallerId = req.params.InstallerId; + const { customerId,hardwareId, tankhardwareId,tankName,tankLocation } = req.body; // Check if the combination of hardwareId and tankhardwareId already exists @@ -109,6 +109,7 @@ exports.addTanks = async (req, reply) => { } const tankData = { + InstallerId:InstallerId, customerId: customerId, hardwareId: hardwareId, tankhardwareId: tankhardwareId, diff --git a/src/models/tanks.js b/src/models/tanks.js index 4c4dae84..a4348860 100644 --- a/src/models/tanks.js +++ b/src/models/tanks.js @@ -33,7 +33,7 @@ const RoleSchema = new Schema({ name: String }); const tanksSchema = new mongoose.Schema({ hardwareId: { type: String }, - + InstallerId: { type: String, default: null }, tankhardwareId: { type: String }, hardwareId_type: { type: String }, hardwareId_company: { type: String }, diff --git a/src/routes/tanksRoute.js b/src/routes/tanksRoute.js index 7cf084b2..25bd5f57 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/:customerId", + url: "/api/addTanks/:InstallerId", schema: { tags: ["Tank"], description: "This is for cretae New Tank", summary: "This is for Create New Tank.", params: { - required: ["customerId"], + required: ["InstallerId"], type: "object", properties: { - customerId: { + InstallerId: { type: "string", - description: "customerId", + description: "InstallerId", }, }, }, @@ -29,7 +29,7 @@ module.exports = function (fastify, opts, next) { tankName: { type: "string" }, blockName: { type: "string"}, capacity: { type: "string" }, - + customerId: { type: "string" }, typeOfWater: { type: "string" }, waterCapacityPerCm:{ type: "string" }, tankLocation: { type: "string" },