diff --git a/src/index.js b/src/index.js index d13a58df..71a9c08e 100644 --- a/src/index.js +++ b/src/index.js @@ -741,9 +741,9 @@ fastify.register(require('fastify-multipart')); // } // }); -fastify.post('/api/uploads_team_member/:departmentId', async (request, reply) => { +fastify.post('/api/uploads_team_member/:customerId', async (request, reply) => { try { - const departmentId = request.params.departmentId; + const customerId = request.params.customerId; const data = await request.file(); // Generate a unique file name @@ -767,7 +767,7 @@ fastify.post('/api/uploads_team_member/:departmentId', async (request, reply) => const publicUrl = `https://storage.googleapis.com/${bucketName}/${filePath}`; TeamMemberProfilePicture.findOneAndUpdate( - { departmentId }, + { customerId }, { picture: publicUrl }, { new: true, upsert: true }, (error, picture) => { diff --git a/src/models/Department.js b/src/models/Department.js index 722dc6a4..da36e9c9 100644 --- a/src/models/Department.js +++ b/src/models/Department.js @@ -119,7 +119,7 @@ const citySchema = new mongoose.Schema( ); const teamMemberProfilePictureSchema = new Schema({ - departmentId: { + customerId: { type: String, unique: true, required: true