diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 8cbdcd80..8f51a80e 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -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) { diff --git a/src/index.js b/src/index.js index d4f8f58e..cf1b1911 100644 --- a/src/index.js +++ b/src/index.js @@ -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,