Skip to content

Commit 8d4f223

Browse files
author
ayush221b
committed
Added new user notification
1 parent d2b1eca commit 8d4f223

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

functions/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,20 @@ exports.projectCreated =
2727
}
2828

2929
return createNotification(notification);
30+
});
31+
32+
exports.userJoined = functions.auth.user().onCreate(user => {
33+
34+
return admin.firestore().collection('users')
35+
.doc(user.uid).get().then(doc => {
36+
37+
const newUser = doc.data();
38+
const notification = {
39+
content: 'Joined the WorkPlace!',
40+
user: `${newUser.firstName} ${newUser.lastName}`,
41+
time: admin.firestore.FieldValue.serverTimestamp()
42+
}
43+
44+
return createNotification(notification);
45+
})
3046
})

0 commit comments

Comments
 (0)