added need sensor? in add tanks

master
Varun 10 months ago
parent c58a824d49
commit f4a50e5ef3

@ -90,7 +90,7 @@ exports.addTanks = async (req, reply) => {
try { try {
const customerId = req.params.customerId; 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({ const existingTank = await Tank.findOne({
@ -98,7 +98,8 @@ exports.addTanks = async (req, reply) => {
hardwareId: hardwareId, hardwareId: hardwareId,
tankhardwareId: tankhardwareId, tankhardwareId: tankhardwareId,
tankName:tankName, tankName:tankName,
tankLocation:tankLocation.toLowerCase() tankLocation:tankLocation.toLowerCase(),
blockName:blockName
}); });
if (existingTank) { if (existingTank) {
@ -119,7 +120,8 @@ exports.addTanks = async (req, reply) => {
waterCapacityPerCm:req.body.waterCapacityPerCm, waterCapacityPerCm:req.body.waterCapacityPerCm,
height:req.body.height, height:req.body.height,
length:req.body.length, length:req.body.length,
width:req.body.width width:req.body.width,
need_sensor:req.body.need_sensor
// ... other fields // ... other fields
}; };

@ -50,6 +50,7 @@ const tanksSchema = new mongoose.Schema({
typeOfWater: { type: String, default: null }, typeOfWater: { type: String, default: null },
waterlevel: { type: String, default: "0" }, waterlevel: { type: String, default: "0" },
waterlevel_at_midnight: { 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" }, total_water_added_from_midnight: { type: String, default: "0" },
auto_min_percentage: { type: String, default: "20" }, auto_min_percentage: { type: String, default: "20" },
reserved_percentage: { type: String, default: "20" }, reserved_percentage: { type: String, default: "20" },

@ -37,6 +37,7 @@ module.exports = function (fastify, opts, next) {
height:{ type: "string" }, height:{ type: "string" },
width:{ type: "string" }, width:{ type: "string" },
length:{ type: "string" }, length:{ type: "string" },
need_sensor:{type:"string"}
}, },
}, },
security: [ security: [
@ -92,6 +93,7 @@ module.exports = function (fastify, opts, next) {
height:{ type: "string" }, height:{ type: "string" },
width:{ type: "string" }, width:{ type: "string" },
length:{ type: "string" }, length:{ type: "string" },
need_sensor:{type:"string"}
}, },
}, },
security: [ security: [

Loading…
Cancel
Save