Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "userStar":{
- ".validate":"newData.hasChild('starCount')",
- "stars":{
- "$starUid":{
- ".write":"auth.uid == $starUid &&
- (!data.exists() && newData.exists() &&
- newData.parent().parent().child('starCount').val() == data.parent().parent().child('starCount').val() + 1
- ) ||
- (data.exists() && !newData.exists() &&
- newData.parent().parent().child('starCount').val() == data.parent().parent().child('starCount').val() - 1
- )",
- ".validate": "newData.val() == true"
- }
- },
- "starCount":{
- ".write":"auth != null && newData.isNumber()",
- ".validate":"(newData.val() == data.val() + 1 &&
- newData.parent().child('stars').child(auth.uid).val() == true &&
- !data.parent().child('stars').child(auth.uid).exists()
- ) ||
- (newData.val() == data.val() - 1 &&
- !newData.parent().child('stars').child(auth.uid).exists() &&
- data.parent().child('stars').child(auth.uid).val() == true
- )"
- },
- "$others":{
- ".validate":false
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement