-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.rules.json
More file actions
105 lines (104 loc) 路 4.27 KB
/
Copy pathdatabase.rules.json
File metadata and controls
105 lines (104 loc) 路 4.27 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
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
{
"rules": {
"users": {
"$uid": {
".read": "auth != null && auth.uid === $uid",
".write": "auth != null && auth.uid === $uid"
}
},
"public": {
"trucks": {
".read": true,
".indexOn": ["slug"],
"$truckId": {
".write": "auth != null",
"isPaused": {
".validate": "newData.isBoolean()"
},
"updatedAt": {
".validate": "newData.isNumber()"
}
}
}
},
"pizzaiolos": {
".indexOn": ["stripeAccountId"],
"$uid": {
".read": "auth != null && auth.uid === $uid",
".write": "auth != null && auth.uid === $uid"
}
},
"trucks": {
".read": true,
"$truckId": {
".write": "auth != null && ((data.exists() && data.child('ownerUid').val() === auth.uid) || (!data.exists() && newData.child('ownerUid').val() === auth.uid))"
}
},
"menus": {
".read": true,
"$truckId": {
".write": "auth != null && root.child('trucks').child($truckId).child('ownerUid').val() === auth.uid"
}
},
"orders": {
".read": "auth != null && ((query.orderByChild == 'truckId' && query.equalTo != null && (query.equalTo == root.child('pizzaiolos').child(auth.uid).child('truckId').val() || root.child('trucks').child(query.equalTo).child('ownerUid').val() == auth.uid)) || (query.orderByChild == 'userUid' && query.equalTo == auth.uid) || (query.orderByChild == 'uid' && query.equalTo == auth.uid))",
"$orderId": {
".read": "auth != null && (data.child('uid').val() === auth.uid || data.child('userUid').val() === auth.uid || root.child('pizzaiolos').child(auth.uid).child('truckId').val() === data.child('truckId').val() || root.child('trucks').child(data.child('truckId').val()).child('ownerUid').val() === auth.uid)",
".write": false,
"uxRating": {
".write": "auth != null && (data.parent().child('uid').val() === auth.uid || data.parent().child('userUid').val() === auth.uid) && !data.exists()",
".validate": "newData.hasChildren(['score', 'submittedAt']) && newData.child('score').isNumber() && newData.child('score').val() >= 1 && newData.child('score').val() <= 5"
}
},
".indexOn": ["uid", "userUid", "truckId", "status", "v2/kitchenStatus", "v2/promisedAtMs"]
},
"orderEvents": {
".read": false,
"$orderId": {
".read": "auth != null && (root.child('orders').child($orderId).child('uid').val() === auth.uid || root.child('orders').child($orderId).child('userUid').val() === auth.uid || root.child('pizzaiolos').child(auth.uid).child('truckId').val() === root.child('orders').child($orderId).child('truckId').val() || root.child('trucks').child(root.child('orders').child($orderId).child('truckId').val()).child('ownerUid').val() === auth.uid)",
".write": false,
".indexOn": ["atMs"]
}
},
"liveOrders": {
"$truckId": {
".read": "auth != null && root.child('pizzaiolos').child(auth.uid).child('truckId').val() === $truckId",
".write": "auth != null && root.child('pizzaiolos').child(auth.uid).child('truckId').val() === $truckId",
".indexOn": ["pizzaioloUid"]
}
},
"carts": {
".indexOn": ["active/expiresAt"],
"$uid": {
".read": "auth != null && auth.uid === $uid",
".write": "auth != null && auth.uid === $uid",
"active": {
".validate": "!newData.exists() || (newData.hasChildren(['items', 'expiresAt']) && newData.child('expiresAt').isNumber() && newData.child('expiresAt').val() <= now + 24 * 60 * 60 * 1000 && (newData.child('truckId').val() === null || newData.child('truckId').isString()))"
}
}
},
"cartsArchive": {
"$uid": {
".read": "auth != null && auth.uid === $uid",
".write": false,
".indexOn": ["archivedAt"]
}
},
"truckOrders": {
"$truckId": {
".read": "auth != null && root.child('trucks').child($truckId).child('ownerUid').val() === auth.uid",
".write": false
}
},
"webhookRateLimit": {
".read": false,
".write": false,
".indexOn": ["windowStart"]
},
"stripeWebhooksProcessed": {
".read": false,
".write": false,
".indexOn": ["processedAt"]
}
}
}