Last active
December 6, 2016 06:07
-
-
Save DennisAlund/b841d8c0d6e95daae5319670896d7545 to your computer and use it in GitHub Desktop.
Gist for the article -- https://medium.com/evenbit/making-a-firebase-server-worker-in-the-cloud-c46c37cc88f3
This file contains hidden or 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
| path /visits/{visit_id} is Visit { | |
| read() { canManageBusiness(this.businessId) } | |
| write() { canManageBusiness(this.businessId) } | |
| } | |
| path /businessVisits/{business_id}/{visit_id} is Visit { | |
| read() { canManageBusiness(business_id) } | |
| } | |
| path /memberVisits/{member_id}/{visit_id} is Visit { | |
| read() { canManageBusiness(this.businessId) } | |
| } | |
| type Visit { | |
| duration: UnsignedNumber | Null, | |
| in: UnsignedNumber, | |
| memberId: String, | |
| out: UnsignedNumber | Null, | |
| businessId: String, | |
| validate() { | |
| (this.out === null || this.duration === (this.out - this.in)) | |
| } | |
| } | |
| type UnsignedNumber extends Number { | |
| validate() { this >= 0 } | |
| } | |
| isSignedIn() { auth !== null } | |
| isCurrentUser(uid) { isSignedIn() && auth.uid === uid } | |
| canManageBusiness(id) { | |
| // Check that the user has proper credentials in your own logic | |
| isSignedIn() | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment