Repository navigation
Expand file tree
/
Copy pathdatabase.rules.json
More file actions
63 lines (63 loc) · 1.76 KB
/
Copy pathdatabase.rules.json
File metadata and controls
63 lines (63 loc) · 1.76 KB
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
{
"rules": {
"presence": {
"$code": {
".read": "$code.matches(/^[A-Z]{4}$/)",
"$id": {
".write": "$code.matches(/^[A-Z]{4}$/)",
".validate": "newData.child('at').isNumber()",
"at": {
".validate": true
},
"pres": {
"seat": {
".validate": "newData.isString()"
},
"screen": {
".validate": "newData.isString() && newData.val().length < 40"
},
"hover": {
".validate": "newData.isNumber()"
},
"aim": {
".validate": "newData.hasChildren(['0', '1'])"
},
"$other": {
".validate": false
}
},
"$other": {
".validate": false
}
}
}
},
"chat": {
"$code": {
".read": "$code.matches(/^[A-Z]{4}$/)",
".indexOn": [
"at"
],
"$id": {
".write": "$code.matches(/^[A-Z]{4}$/) && (!data.exists() || !newData.exists())",
".validate": "newData.hasChildren(['seat', 'at']) && newData.child('at').val() === now && newData.hasChild('e') !== newData.hasChild('t')",
"seat": {
".validate": "newData.val() === 'host' || newData.val() === 'guest'"
},
"at": {
".validate": "newData.isNumber()"
},
"e": {
".validate": "newData.isString() && newData.val().length > 0 && newData.val().length <= 16"
},
"t": {
".validate": "newData.isString() && newData.val().length > 0 && newData.val().length <= 80"
},
"$other": {
".validate": false
}
}
}
}
}
}