[英]Cloud Functions: Firestore Promise chain
I have Firestore database. 我有Firestore数据库。 Colletions simple:
收集简单:
"tasks/{taskId}": {
“ tasks / {taskId}”:{
"ownerUid": "task owner Firebase Uid",“ ownerUid”:“任务所有者Firebase Uid”,
"whoDidUids": ["user_1_FirebaseUid","user_2_FirebaseUid"]“ whoDidUids”:[“ user_1_FirebaseUid”,“ user_2_FirebaseUid”]
}}
"users/{userUid}": {"fcm_token": "firestore cloud messaging token"}
“ users / {userUid}”:{“ fcm_token”:“ firestore云消息传递令牌”}
Want just to write simple Cloud Function which will be triggered on: 只想编写将在以下时间触发的简单云函数:
exports.taskDoneNotification = functions.firestore
.document('tasks/{taskId}')
.onUpdate((event) => {
//when another user did task it means
//userUid will be added to task.whoDidUids array
//I want to get task owner fcmToken and send him
// simple notification like "your task done by someone!"
});
I'am new to js syntax, writing on Kotlin for Android. 我是js语法的新手,是在Android的Kotlin上编写的。
Please provide me some examples how to do this? 请提供一些示例,以说明如何执行此操作?
I was trying to do something similar. 我正在尝试做类似的事情。
Unfortunately the "auth" object where you would get the UserId from is no yet implemented in Firestore Database Triggers. 不幸的是,Firestore数据库触发器中尚未实现从中获取UserId的“ auth”对象。 :(
:(
See here: 看这里:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.