Created
June 6, 2019 18:48
-
-
Save AnushanLingam/998f01ebccd74e7f56c82694be4af501 to your computer and use it in GitHub Desktop.
Realtime database rules for Money Monitor
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
{ | |
"rules": { | |
".read": false, | |
".write": false, | |
"users" : { | |
"$user_id" : { | |
".read": "$user_id === auth.uid", | |
".write": "$user_id === auth.uid", | |
"firstRun": { | |
".validate": "newData.isBoolean()" | |
}, | |
"expenses": { | |
"$expense_id": { | |
".validate": "newData.hasChildren(['title', 'note','createdAt', 'amount'])", | |
"title": { | |
".validate": "newData.isString() && newData.val().length > 0" | |
}, | |
"note": { | |
".validate": "newData.isString()" | |
}, | |
"createdAt": { | |
".validate": "newData.isNumber()" | |
}, | |
"amount": { | |
".validate": "newData.isNumber()" | |
}, | |
"category" : { | |
".validate": "newData.isString()" | |
}, | |
"$other": { | |
".validate": false | |
} | |
} | |
}, | |
"savings": { | |
"$saving_id": { | |
".validate" : "newData.hasChildren(['title', 'goal', 'amount'])", | |
"title": { | |
".validate": "newData.isString() && newData.val().length > 0" | |
}, | |
"goal": { | |
".validate": "newData.isNumber()" | |
}, | |
"amount": { | |
".validate": "newData.isNumber()" | |
}, | |
"$other": { | |
".validate": false | |
} | |
} | |
}, | |
"preferences": { | |
"currency": { | |
".validate" : "newData.isString() && newData.val().length > 0" | |
}, | |
"userCategories" : { | |
"$userCategory_id" : { | |
".validate": "newData.hasChildren(['name'])", | |
"name" : { | |
".validate": "newData.isString() && newData.val().length > 0" | |
}, | |
"$other": { | |
".validate": false | |
} | |
} | |
}, | |
"theme" : { | |
".validate" : "newData.isString() && newData.val().length > 0" | |
}, | |
"$other": { | |
".validate": false | |
} | |
}, | |
"$other": { | |
".validate": false | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment