|
|
|
@ -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) => {
|
|
|
|
|