|
|
@ -1,7 +1,7 @@
|
|
|
|
//const Tank = require("../models/tanks");
|
|
|
|
//const Tank = require("../models/tanks");
|
|
|
|
const { Tank, MotorData, IotData,MotorIot,TankWaterLevel,TankConsumptionSchema } = require('../models/tanks')
|
|
|
|
const { Tank, MotorData, IotData,MotorIot,TankWaterLevel,TankConsumptionSchema } = require('../models/tanks')
|
|
|
|
|
|
|
|
|
|
|
|
const User = require("../models/User");
|
|
|
|
const {User} = require("../models/User");
|
|
|
|
const boom = require("boom");
|
|
|
|
const boom = require("boom");
|
|
|
|
const fastify = require("fastify")({
|
|
|
|
const fastify = require("fastify")({
|
|
|
|
logger: true,
|
|
|
|
logger: true,
|
|
|
@ -339,6 +339,10 @@ exports.getTanklevels = async (req, reply) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const user = await User.findOne({ customerId: customerId });
|
|
|
|
|
|
|
|
const buildingName = user ? user.buildingName : null;
|
|
|
|
|
|
|
|
const address1 = user ? user.profile.address1 : null;
|
|
|
|
|
|
|
|
|
|
|
|
const responseData = {
|
|
|
|
const responseData = {
|
|
|
|
status_code: 200,
|
|
|
|
status_code: 200,
|
|
|
|
data: updated_data,
|
|
|
|
data: updated_data,
|
|
|
@ -350,6 +354,8 @@ exports.getTanklevels = async (req, reply) => {
|
|
|
|
totalDrinkingWaterInOverheadCapacity: sumOverheadDrinkingWaterCapacity,
|
|
|
|
totalDrinkingWaterInOverheadCapacity: sumOverheadDrinkingWaterCapacity,
|
|
|
|
totalBoreWaterInSumpCapacity: sumSumpBoreWaterCapacity,
|
|
|
|
totalBoreWaterInSumpCapacity: sumSumpBoreWaterCapacity,
|
|
|
|
totalBoreWaterInOverheadCapacity: sumOverheadBoreWaterCapacity,
|
|
|
|
totalBoreWaterInOverheadCapacity: sumOverheadBoreWaterCapacity,
|
|
|
|
|
|
|
|
buildingName: buildingName,
|
|
|
|
|
|
|
|
address1: address1,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if (!reply.sent) {
|
|
|
|
if (!reply.sent) {
|
|
|
@ -366,6 +372,7 @@ exports.getTanklevels = async (req, reply) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const intervals = {};
|
|
|
|
const intervals = {};
|
|
|
|
let sump_water_levels=[];
|
|
|
|
let sump_water_levels=[];
|
|
|
|
let supplier_tanks = [];
|
|
|
|
let supplier_tanks = [];
|
|
|
|