guestbook.schema.json 1.0 KB
Newer Older
DCloud_JSON's avatar
DCloud_JSON 已提交
1 2 3 4 5 6 7 8 9 10 11 12
// 文档教程: https://uniapp.dcloud.net.cn/uniCloud/schema
{
	"bsonType": "object",
	"required": [],
	"permission": {
		"read":  "doc.state || auth.uid == doc.user_id || 'AUDITOR' in auth.role",
		"create": "auth.uid != null",
		"update": "'AUDITOR' in auth.role",
		"delete": "auth.uid == doc.user_id"
	},
	"properties": {
		"_id": {
雪洛's avatar
雪洛 已提交
13 14 15
			"description": "ID,系统自动生成",
			"permission":{
				"write":false
DCloud_JSON's avatar
DCloud_JSON 已提交
16 17 18
			}
		},
		"text": {
雪洛's avatar
雪洛 已提交
19 20 21
			"bsonType": "string",
			"permission":{
				"write":false
DCloud_JSON's avatar
DCloud_JSON 已提交
22 23 24 25 26 27
			}
		},
		"user_id": {
			"forceDefaultValue": {
				"$env": "uid"
			},
雪洛's avatar
雪洛 已提交
28 29 30
			"foreignKey": "uni-id-users._id",
			"permission":{
				"write":false
DCloud_JSON's avatar
DCloud_JSON 已提交
31 32 33 34 35
			}
		},
		"ip": {
			"forceDefaultValue": {
				"$env": "clientIP"
雪洛's avatar
雪洛 已提交
36 37 38
			},
			"permission":{
				"write":false
DCloud_JSON's avatar
DCloud_JSON 已提交
39 40 41 42 43
			}
		},
		"create_time": {
			"forceDefaultValue": {
				"$env": "now"
雪洛's avatar
雪洛 已提交
44 45 46
			},
			"permission":{
				"write":false
DCloud_JSON's avatar
DCloud_JSON 已提交
47 48 49 50 51 52 53 54 55 56
			}
		},
		"state": {
			"bsonType": "bool",
			"forceDefaultValue":false,
			"permission":{
				"write":true
			}
		}
	}
雪洛's avatar
雪洛 已提交
57
}