diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 0b2be5af..d95a35c5 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -90,7 +90,7 @@ exports.addTanks = async (req, reply) => { try { const customerId = req.params.customerId; - const { hardwareId, tankhardwareId,tankName,tankLocation } = req.body; + const { hardwareId, tankhardwareId,tankName,tankLocation,need_sensor,blockName } = req.body; const existingTank = await Tank.findOne({ @@ -98,7 +98,8 @@ exports.addTanks = async (req, reply) => { hardwareId: hardwareId, tankhardwareId: tankhardwareId, tankName:tankName, - tankLocation:tankLocation.toLowerCase() + tankLocation:tankLocation.toLowerCase(), + blockName:blockName }); if (existingTank) { @@ -119,7 +120,8 @@ exports.addTanks = async (req, reply) => { waterCapacityPerCm:req.body.waterCapacityPerCm, height:req.body.height, length:req.body.length, - width:req.body.width + width:req.body.width, + need_sensor:req.body.need_sensor // ... other fields }; diff --git a/src/models/tanks.js b/src/models/tanks.js index d6274101..04d4813e 100644 --- a/src/models/tanks.js +++ b/src/models/tanks.js @@ -50,6 +50,7 @@ const tanksSchema = new mongoose.Schema({ typeOfWater: { type: String, default: null }, waterlevel: { type: String, default: "0" }, waterlevel_at_midnight: { type: String, default: "0" }, + need_sensor:{ type: String, default: "no" }, total_water_added_from_midnight: { type: String, default: "0" }, auto_min_percentage: { type: String, default: "20" }, reserved_percentage: { type: String, default: "20" }, diff --git a/src/routes/tanksRoute.js b/src/routes/tanksRoute.js index a88e2bc8..e1c5a324 100644 --- a/src/routes/tanksRoute.js +++ b/src/routes/tanksRoute.js @@ -37,6 +37,7 @@ module.exports = function (fastify, opts, next) { height:{ type: "string" }, width:{ type: "string" }, length:{ type: "string" }, + need_sensor:{type:"string"} }, }, security: [ @@ -92,6 +93,7 @@ module.exports = function (fastify, opts, next) { height:{ type: "string" }, width:{ type: "string" }, length:{ type: "string" }, + need_sensor:{type:"string"} }, }, security: [