33 lines
1.0 KiB
JSON
33 lines
1.0 KiB
JSON
{
|
|
"bsonType": "object",
|
|
"required": ["user_id", "article_id", "last_view_time", "first_view_time"],
|
|
"permission": {
|
|
"read": "doc.user_id == auth.uid || 'admin' in auth.role", // 用户仅查看自己记录
|
|
"create": "auth.uid != null", // 登录用户自动记录
|
|
"update": "false", // 日志不可修改
|
|
"delete": "'admin' in auth.role" // 仅管理员可删除
|
|
},
|
|
"properties": {
|
|
"_id": {
|
|
"description": "系统自动生成的文档ID",
|
|
"bsonType": "string"
|
|
},
|
|
"user_id": {
|
|
"bsonType": "string",
|
|
"foreignKey": "uni-id-users._id",
|
|
"pattern": "^[0-9a-f]{24}$"
|
|
},
|
|
"article_id": {
|
|
"bsonType": "string",
|
|
"foreignKey": "uni-cms-articles._id",
|
|
"pattern": "^[0-9a-f]{24}$"
|
|
},
|
|
"create_time": {
|
|
"bsonType": "timestamp",
|
|
"description": "首次浏览时间",
|
|
"defaultValue": {"$env": "now"},
|
|
"errorMessage": "时间戳必须为有效数值"
|
|
}
|
|
|
|
}
|
|
} |