teammember picture installation

master^2
Bhaskar 2 weeks ago
parent 579b90e510
commit 6be95bc55d

@ -1271,12 +1271,13 @@ fastify.post("/api/uploads_installation_TeamMember_profile/:installationId/:team
const publicUrl = `https://storage.googleapis.com/${bucketName}/${filePath}`; const publicUrl = `https://storage.googleapis.com/${bucketName}/${filePath}`;
// Always upsert the installation-level picture doc // Always upsert the installation-level picture doc
await ProfilePictureInstall.findOneAndUpdate( await ProfilePictureInstallTeamMember.findOneAndUpdate(
{ installationId }, { installationId, teamMemberId },
{ picture: publicUrl }, { picture: publicUrl },
{ new: true, upsert: true } { new: true, upsert: true }
); );
// Update department picture where departmentId === installationId // Update department picture where departmentId === installationId
const deptUpdate = await Deparments.findOneAndUpdate( const deptUpdate = await Deparments.findOneAndUpdate(
{ departmentId: installationId }, { departmentId: installationId },

@ -258,6 +258,11 @@ const installationschema = new mongoose.Schema({
}); });
const profilePictureInstallTeamMemberSchema = new Schema({ const profilePictureInstallTeamMemberSchema = new Schema({
installationId: {
type: String,
unique: true,
required: true
},
teamMemberId: { teamMemberId: {
type: String, type: String,
unique: true, unique: true,

Loading…
Cancel
Save