-
Notifications
You must be signed in to change notification settings - Fork 31
/
schema.json
executable file
·156 lines (156 loc) · 4.32 KB
/
schema.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
{
"rules": {
".write": false,
"group": {
"$group": {
".write": "!data.exists()",
"members": {
".read": true,
"$member": {
".write": "!data.exists() || data.val() == auth.id",
".validate": "newData.isString() && root.child('user/' + newData.val()).exists()"
}
},
"messages": {
".read": "root.child('group/' + $group + '/members/' + auth.id).exists()",
"$message": {
".write": "!data.exists()",
"author": {
".validate": "newData.isString() && newData.val() == auth.id && root.child('user/' + newData.val()).exists()"
},
"created": {
".validate": "newData.isNumber() && newData.val() < now"
},
"text": {
".validate": "newData.isString()"
}
}
},
"name": {
".read": true,
".validate": "newData.isString()"
}
}
},
"lastPlayed": {
".read": true,
"$track": {
".write": "!data.exists()",
".validate": "newData.isString() && root.child('track/' + newData.val()).exists()"
}
},
"track": {
".read": true,
"$track": {
".write": true,
".validate": "!(data.child('lastPlayed').exists() && newData.child('lastPlayed').val() == null) && !(data.child('playCount').exists() && newData.child('playCount').val() == null)",
"artist": {
".validate": "newData.isString()"
},
"genre": {
".validate": "newData.isString()"
},
"lastPlayed": {
".validate": "newData.isNumber() && (!data.exists() || data.val() < newData.val()) && newData.val() < now"
},
"lastPlayedBy": {
".validate": "newData.isString() && newData.val() == auth.id && root.child('user/' + newData.val()).exists()"
},
"length": {
".validate": "newData.isNumber()"
},
"playCount": {
".validate": "newData.isNumber() && ((!data.exists() && newData.val() == 0) || data.val() + 1 == newData.val())"
},
"title": {
".validate": "newData.isString()"
},
"year": {
".validate": "newData.isNumber()"
},
"youtubeid": {
".validate": "newData.isString()"
},
"youtubeviews": {
".validate": "newData.isNumber()"
}
}
},
"user": {
".read": true,
"$user": {
".write": "$user == auth.id",
"groups": {
"$group": {
".validate": "newData.isString() && root.child('group/' + newData.val()).exists()"
}
},
"groupinvites": {
"$group": {
".write": "!data.exists()",
"from": {
".validate": "newData.isString() && newData.val() == auth.id && root.child('user/' + newData.val()).exists()"
},
"group": {
".validate": "newData.isString() && root.child('group/' + newData.val()).exists()"
}
}
},
"following": {
".validate": "newData.isString() && root.child('user/' + newData.val()).exists()"
},
"hotlist": {
"$user": {
".validate": "newData.isString() && root.child('user/' + newData.val()).exists()"
}
},
"isOnline": {
".validate": "newData.isBoolean()"
},
"library": {
"$track": {
".validate": "newData.isString() && root.child('track/' + newData.val()).exists()"
}
},
"nowPlaying": {
"isPlaying": {
".validate": "newData.isBoolean()"
},
"manualSet": {
".validate": "newData.isBoolean()"
},
"lastChange": {
".validate": "newData.isNumber() && newData.val() < now"
},
"time": {
".validate": "newData.isNumber()"
},
"track": {
".validate": "newData.isString() && root.child('track/' + newData.val()).exists()"
}
},
"transfers": {
"$transfer": {
".write": "!data.exists()",
"from": {
".validate": "newData.isString() && newData.val() == auth.id && root.child('user/' + newData.val()).exists()"
},
"track": {
".validate": "newData.isString() && root.child('track/' + newData.val()).exists()"
}
}
},
"username": {
".validate": "newData.isString() && (newData.val() + '@firebase.com') == auth.email"
}
}
},
"username": {
".read": true,
"$username": {
".write": "($username + '@firebase.com') == auth.email",
".validate": "newData.isString() && newData.val() == auth.id"
}
}
}
}