Last active
August 29, 2019 11:57
-
-
Save Viveckh/9cc2e476d246678137e8e4e22ed40721 to your computer and use it in GitHub Desktop.
Dating App - Firebase Realtime Database Schema - User
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
Show hidden characters
"users": { | |
// Anyone who is authenticated can read user info | |
".read": "auth.uid != null", | |
"$uid": { | |
// But a user can only update their own info | |
".write": "auth.uid === $uid", | |
// At least the name of the user should be provided to set | |
".validate": "newData.hasChildren(['name'])", | |
"name": { ".validate": "newData.exists() && newData.isString()" }, | |
// Birth date fields can only be changed once | |
"birth_year": { ".validate": "!data.exists() && newData.exists()" }, | |
"birth_month": { ".validate": "!data.exists() && newData.exists()" }, | |
// Location can be updated as frequenty as users choose to | |
"current_country": { ".validate": "newData.exists() && newData.isString()" }, | |
"current_city": { ".validate": "newData.exists() && newData.isString()" }, | |
"current_zip": { ".validate": "newData.exists()" } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment