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