From 7b282bdcb9fbb39a4f92ba2e67098ba73548f2d4 Mon Sep 17 00:00:00 2001 From: Bhaskar Date: Wed, 5 Feb 2025 15:43:15 +0530 Subject: [PATCH 1/2] company profile picture --- src/index.js | 6 +++--- src/models/Department.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index 456f613b..f37ddccc 100644 --- a/src/index.js +++ b/src/index.js @@ -792,9 +792,9 @@ fastify.post('/api/uploads_team_member/:departmentId', async (request, reply) => } }); -fastify.post('/api/uploads_company_profile/:cityId', async (request, reply) => { +fastify.post('/api/uploads_company_profile/:customerId', async (request, reply) => { try { - const cityId = request.params.cityId; + const customerId = request.params.customerId; const data = await request.file(); // Generate a unique file name @@ -818,7 +818,7 @@ fastify.post('/api/uploads_company_profile/:cityId', async (request, reply) => { const publicUrl = `https://storage.googleapis.com/${bucketName}/${filePath}`; CompanyProfilePicture.findOneAndUpdate( - { cityId }, + { customerId }, { picture: publicUrl }, { new: true, upsert: true }, (error, picture) => { diff --git a/src/models/Department.js b/src/models/Department.js index 273b47cf..e6e0420e 100644 --- a/src/models/Department.js +++ b/src/models/Department.js @@ -138,7 +138,7 @@ const citySchema = new mongoose.Schema( }); const companyProfilePictureSchema = new Schema({ - cityId: { + customerId: { type: String, unique: true, required: true From 9ecf77e259b95ff13c85594e7efe427aecff6b6d Mon Sep 17 00:00:00 2001 From: Bhaskar Date: Wed, 5 Feb 2025 16:02:17 +0530 Subject: [PATCH 2/2] picture added in department schema --- src/controllers/departmentController.js | 2 ++ src/models/Department.js | 1 + src/routes/departmentRoute.js | 1 + 3 files changed, 4 insertions(+) diff --git a/src/controllers/departmentController.js b/src/controllers/departmentController.js index 7e8de3f5..91832060 100644 --- a/src/controllers/departmentController.js +++ b/src/controllers/departmentController.js @@ -475,6 +475,7 @@ exports.addDepartment = async (request, reply) => { pincode, desginationName, location, + picture, createdBy, updatedBy, } = request.body; @@ -517,6 +518,7 @@ exports.addDepartment = async (request, reply) => { pincode, desginationName, location, + picture, createdBy, updatedBy, }); diff --git a/src/models/Department.js b/src/models/Department.js index e6e0420e..722dc6a4 100644 --- a/src/models/Department.js +++ b/src/models/Department.js @@ -98,6 +98,7 @@ const citySchema = new mongoose.Schema( personal_city: { type: String }, state: String, country: String, + picture:{type:String}, services: { password: { bcrypt: String } }, createdAt: { type: Date, diff --git a/src/routes/departmentRoute.js b/src/routes/departmentRoute.js index e5e7f4b2..4fec9e1c 100644 --- a/src/routes/departmentRoute.js +++ b/src/routes/departmentRoute.js @@ -204,6 +204,7 @@ module.exports = function (fastify, opts, next) { officeName: { type: "string"}, reportingManager_mobile_number: { type: "string"}, reportingManager_email: { type: "string"}, + picture: { type: "string"}, location: { type: "array", items: { type: "string" },