From 223bbdea42e317fdddf3c7e50e8ecd4b8f11cd77 Mon Sep 17 00:00:00 2001 From: Varun Date: Tue, 26 Nov 2024 16:52:39 +0530 Subject: [PATCH 1/2] added length and width in add and edit tanks,added bulding name for edit in edit user --- src/controllers/tanksController.js | 5 ++++- src/controllers/userController.js | 2 +- src/models/tanks.js | 2 ++ src/routes/tanksRoute.js | 4 ++++ src/routes/usersRoute.js | 1 + 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index ff7e52fd..a8f8529d 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -116,7 +116,10 @@ exports.addTanks = async (req, reply) => { typeOfWater: req.body.typeOfWater, tankLocation: req.body.tankLocation.toLowerCase(), waterCapacityPerCm:req.body.waterCapacityPerCm, - height:req.body.height + height:req.body.height, + length:req.body.length, + width:req.body.width + // ... other fields }; diff --git a/src/controllers/userController.js b/src/controllers/userController.js index 05d93c95..e11a36d7 100644 --- a/src/controllers/userController.js +++ b/src/controllers/userController.js @@ -109,7 +109,7 @@ exports.editCuurentUserInfo = async (req, reply) => { const { customerId } = req.params; const userInfo = await User.findOne({ customerId: customerId.toString() }); const updateData = req.body; - + if (updateData.buildingName) userInfo.buildingName = updateData.buildingName if (updateData.firstName) userInfo.profile.firstName = updateData.firstName; if (updateData.lastName) userInfo.profile.lastName = updateData.lastName; if (updateData.username) userInfo.username = updateData.username; diff --git a/src/models/tanks.js b/src/models/tanks.js index 3a023f7f..33859a56 100644 --- a/src/models/tanks.js +++ b/src/models/tanks.js @@ -42,6 +42,8 @@ const tanksSchema = new mongoose.Schema({ blockName: { type: String, default: null }, capacity: { type: String, default: "0" }, height: { type: String, default: "0" }, + length: { type: String, default: "0" }, + width: { type: String, default: "0" }, tankLocation: { type: String, default: null }, waterCapacityPerCm: { type: String, default: "0" }, typeOfWater: { type: String, default: null }, diff --git a/src/routes/tanksRoute.js b/src/routes/tanksRoute.js index 1521856c..fe4fd075 100644 --- a/src/routes/tanksRoute.js +++ b/src/routes/tanksRoute.js @@ -34,6 +34,8 @@ module.exports = function (fastify, opts, next) { waterCapacityPerCm:{ type: "string" }, tankLocation: { type: "string" }, height:{ type: "string" }, + width:{ type: "string" }, + length:{ type: "string" }, }, }, security: [ @@ -86,6 +88,8 @@ module.exports = function (fastify, opts, next) { waterCapacityPerCm:{ type: "string" }, tankLocation: { type: "string" }, height:{ type: "string" }, + width:{ type: "string" }, + length:{ type: "string" }, }, }, security: [ diff --git a/src/routes/usersRoute.js b/src/routes/usersRoute.js index 8b75e74a..da2ce8ad 100644 --- a/src/routes/usersRoute.js +++ b/src/routes/usersRoute.js @@ -417,6 +417,7 @@ module.exports = function (fastify, opts, next) { properties: { phone: { type: "string" }, firstName: { type: "string" }, + buildingName: { type: "string" }, lastName: { type: "string" }, username: { type: "string" }, emails: { From f095fec354705a8d097fabcb52ee8d243ed15d30 Mon Sep 17 00:00:00 2001 From: Varun Date: Tue, 26 Nov 2024 17:23:06 +0530 Subject: [PATCH 2/2] added shape in add and edit tanks --- src/controllers/tanksController.js | 1 + src/models/tanks.js | 1 + src/routes/tanksRoute.js | 2 ++ 3 files changed, 4 insertions(+) diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index a8f8529d..4a4e5350 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -110,6 +110,7 @@ exports.addTanks = async (req, reply) => { customerId: customerId, hardwareId: hardwareId, tankhardwareId: tankhardwareId, + shape: req.body.shape, tankName: req.body.tankName, blockName: req.body.blockName, capacity: req.body.capacity, diff --git a/src/models/tanks.js b/src/models/tanks.js index 33859a56..d9dfc9fd 100644 --- a/src/models/tanks.js +++ b/src/models/tanks.js @@ -40,6 +40,7 @@ const tanksSchema = new mongoose.Schema({ customerId: { type: String, default: null }, tankName: { type: String, default: null }, blockName: { type: String, default: null }, + shape: { type: String, default: null }, capacity: { type: String, default: "0" }, height: { type: String, default: "0" }, length: { type: String, default: "0" }, diff --git a/src/routes/tanksRoute.js b/src/routes/tanksRoute.js index fe4fd075..d74c0809 100644 --- a/src/routes/tanksRoute.js +++ b/src/routes/tanksRoute.js @@ -33,6 +33,7 @@ module.exports = function (fastify, opts, next) { typeOfWater: { type: "string" }, waterCapacityPerCm:{ type: "string" }, tankLocation: { type: "string" }, + shape:{ type: "string" }, height:{ type: "string" }, width:{ type: "string" }, length:{ type: "string" }, @@ -83,6 +84,7 @@ module.exports = function (fastify, opts, next) { tankName: { type: "string" }, blockName: { type: "string"}, capacity: { type: "string" }, + shape: { type: "string" }, // customerId: { type: "string" }, typeOfWater: { type: "string" }, waterCapacityPerCm:{ type: "string" },