Files
t/uniCloud-alipay/database/cms-articles-log.schema.json
T
2025-03-12 20:11:03 +08:00

39 lines
1.2 KiB
JSON

{
"bsonType": "object",
"required": ["user_id", "article_id", "last_view_time", "first_view_time"],
"permission": {
"read": true, // 用户仅查看自己记录
"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}$"
},
"first_view_time": {
"bsonType": "timestamp",
"description": "首次浏览时间",
"defaultValue": {"$env": "now"},
"errorMessage": "时间戳必须为有效数值"
},
"last_view_time": {
"bsonType": "timestamp",
"description": "最近浏览时间",
"defaultValue": {"$env": "now"},
"errorMessage": "时间戳必须为有效数值"
}
}
}