mirror of
https://github.com/labring/laf.git
synced 2026-01-25 16:07:45 +00:00
40 lines
1.3 KiB
JSON
40 lines
1.3 KiB
JSON
{
|
|
"categories": {
|
|
".read": true,
|
|
".update": "$role === 'admin'",
|
|
".add": "$role === 'admin'",
|
|
".remove": "$role === 'admin'"
|
|
},
|
|
"articles": {
|
|
".read": true,
|
|
".update": {
|
|
"condition": "$admin === true",
|
|
"data": {
|
|
"title": {"length": [1, 64], "required": true },
|
|
"content": {"length": [1, 20480]},
|
|
"password": { "match": "^\\d{6,10}$"},
|
|
"author_id": "value == $userid"
|
|
},
|
|
"query": {
|
|
"_id": "get($value).author_id === $userid"
|
|
}
|
|
},
|
|
".add": {
|
|
"condition": "$admin === true",
|
|
"data": {
|
|
"type": {"required": true, "in": ["choice", "fill"]},
|
|
"title": {"length": [4, 64], "required": true, "unique": true},
|
|
"content": {"length": [4, 20480]},
|
|
"total": {"number": [0, 100], "default": 0, "required": true},
|
|
"author_id": { "condition": "$value == $userid" }
|
|
}
|
|
},
|
|
".remove": {
|
|
"condition":"$admin === true",
|
|
"query": {
|
|
"id": "get($value).author_id === $userid // TODO 尚未实现 get 函数"
|
|
}
|
|
}
|
|
}
|
|
}
|