changes in tank levels

master
varun 1 year ago
parent c194d18394
commit 54d9f6dbae

@ -317,6 +317,9 @@ exports.getTanklevels = async (req, reply) => {
const updated_data = await Tank.find({ customerId: customerId });
console.log("updated_data", updated_data);
const user = await User.findOne({ customerId: customerId });
const buildingName = user ? user.buildingName : null;
const address1 = user ? user.profile.address1 : null;
updated_data.forEach((tank) => {
const waterlevel = parseInt(tank.waterlevel.replace(/,/g, ''), 10);
@ -350,6 +353,8 @@ exports.getTanklevels = async (req, reply) => {
totalDrinkingWaterInOverheadCapacity: sumOverheadDrinkingWaterCapacity,
totalBoreWaterInSumpCapacity: sumSumpBoreWaterCapacity,
totalBoreWaterInOverheadCapacity: sumOverheadBoreWaterCapacity,
buildingName: buildingName,
address1: address1,
};
if (!reply.sent) {

@ -219,7 +219,7 @@ fastify.post("/api/login", {
error: false,
apiversion: fastify.config.APIVERSION,
access_token: token,
buildingName:loginObject.buildingName,
email: loginObject.user.emails,
phone: loginObject.user.phone,
customerId: loginObject.user.customerId,
@ -244,6 +244,7 @@ fastify.post("/api/login", {
picture:profilePicture.picture,
email: loginObject.user.emails,
phone: loginObject.user.phone,
buildingName:loginObject.buildingName,
customerId: loginObject.user.customerId,
username: loginObject.user.username,
address1: loginObject.user.profile.address1,

Loading…
Cancel
Save