Created
August 18, 2021 17:11
-
-
Save kamaravichow/d56d74a154a80efd24d149b56f2de1ca 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
function isValidNewPost() { | |
let post = request.resource.data; | |
let isOwner = post.uid request.auth.uid; | |
let isNotFromPastOrFuture = request.time == request.resource.data.timestamp; | |
let hasMandatoryFields = post.keys().hasAll(['caption', 'uid', 'timestamp', 'published']); | |
return isOwner && hasMandatoryFields && isNotFromPastorFuture; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think line 3 is missing the "equals".
Should it not read like this?:
let isOwner = post.uid == request.auth.uid;