From aed062e573605dae2c8711cc3639a8e479fc30dc Mon Sep 17 00:00:00 2001 From: Bhaskar Date: Mon, 3 Feb 2025 13:10:50 +0530 Subject: [PATCH] email added in city chnages --- src/controllers/departmentController.js | 6 +++++- src/models/Department.js | 1 + src/routes/departmentRoute.js | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/controllers/departmentController.js b/src/controllers/departmentController.js index bfe1aa40..69d9486b 100644 --- a/src/controllers/departmentController.js +++ b/src/controllers/departmentController.js @@ -67,6 +67,7 @@ const generateDepartmentId = async (city, departmentName) => { pincode, createdBy, updatedBy, + email } = request.body; // Generate departmentId based on departmentName @@ -92,6 +93,7 @@ const generateDepartmentId = async (city, departmentName) => { zone, country, pincode, + email, // departmentName, createdBy, updatedBy, @@ -202,6 +204,7 @@ const generateDepartmentId = async (city, departmentName) => { address1, address2, pincode, + email // departmentName } = request.body; @@ -228,7 +231,8 @@ const generateDepartmentId = async (city, departmentName) => { existing.address1 = address1 || existing.address1; existing.address2 = address2 || existing.address2; - + existing.email = email || existing.email; + await existing.save(); diff --git a/src/models/Department.js b/src/models/Department.js index 9ccbce64..eec39c34 100644 --- a/src/models/Department.js +++ b/src/models/Department.js @@ -11,6 +11,7 @@ const citySchema = new mongoose.Schema( phone: { type: String, unique: true, trim: true }, office_address1: String, officeName: { type: String }, + email: { type: String }, address2: String, pincode: { type: String }, zone: { type: String }, diff --git a/src/routes/departmentRoute.js b/src/routes/departmentRoute.js index 67f6dc14..891fe819 100644 --- a/src/routes/departmentRoute.js +++ b/src/routes/departmentRoute.js @@ -20,6 +20,7 @@ module.exports = function (fastify, opts, next) { items: { type: "string" }, }, state: { type: "string" }, + email: { type: "string" }, country: { type: "string" }, office_address1: { type: "string" }, address2: { type: "string" }, @@ -144,6 +145,7 @@ module.exports = function (fastify, opts, next) { zone: { type: "string" }, pincode: { type: "string" }, departmentName: { type: "string" }, + email: { type: "string" }, }, }