Created
October 17, 2018 20:39
-
-
Save schmidt-sebastian/c411f426dd92a8cf20632ecaf4db25fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require('firebase-functions'); | |
const admin = require('firebase-admin'); | |
const firestore = admin.firestore(); | |
exports.activityLog = functions.firestore | |
.document('privacy/{uid}').onWrite(snap => { | |
const uid = context.params.uid; | |
const settings = snap.data(); | |
settings['udpate_time'] = | |
admin.firestore.FieldValue.serverTimestamp(); | |
firestore.collection( | |
`activity_log/${uid}/entries` | |
).add(settings); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
match /activity_log/{uid} { | |
allow create: if request.auth.uid == uid; | |
allow update: if false; | |
allow delete: if false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment