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 {
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
};

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

@ -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: [

Loading…
Cancel
Save