update map:profilephoto

This commit is contained in:
shams mosowi
2019-10-28 17:38:48 +11:00
parent db1ef996ee
commit ddc8d0a281
3 changed files with 4 additions and 2 deletions

1
.gitignore vendored
View File

@@ -22,6 +22,7 @@ cloud_functions/functions/lib
.env.production.local
www/.env
.env.production
.env.development
npm-debug.log*
yarn-debug.log*

View File

@@ -9,7 +9,8 @@
{ "fromField": "lastName", "toField": "lastName" },
{ "fromField": "preferredName", "toField": "preferredName" },
{ "fromField": "personalBio", "toField": "background" },
{ "fromField": "role", "toField": "role" }
{ "fromField": "role", "toField": "role" },
{ "fromField": "profilePhoto", "toField": "profilePhoto" }
]
}
]

View File

@@ -8,7 +8,7 @@ export const users = functions.firestore
const afterData = change.after.data();
if (afterData) {
if( afterData.founder[0].docPath){
const updates = {firstName:afterData.firstName,lastName:afterData.lastName,preferredName:afterData.preferredName,background:afterData.personalBio,role:afterData.role}
const updates = {firstName:afterData.firstName,lastName:afterData.lastName,preferredName:afterData.preferredName,background:afterData.personalBio,role:afterData.role,profilePhoto:afterData.profilePhoto}
console.log(`updates FROM users/${context.params.id} TO ${afterData.founder[0].docPath}`, updates)
await db.doc(afterData.founder[0].docPath).set(updates, { merge: true });
}