Files
2025-03-12 20:11:03 +08:00

94 lines
2.9 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"bsonType": "object",
"required": ["content", "author_id", "article_id", "create_time"],
"permission": {
"read": "true",
"create": "auth.uid != null", // 登录用户可创建
"update": "doc.author_id == auth.uid || 'admin' in auth.role", // 仅作者可修改
"delete": "doc.author_id == auth.uid || 'admin' in auth.role" // 作者或管理员可删除
},
"properties": {
"_id": {
"description": "ID,系统自动生成",
"bsonType": "string"
},
"content": {
"bsonType": "string",
"title": "评论内容",
"minLength": 1,
"maxLength": 500,
"errorMessage": "评论内容不能为空且不超过500字"
},
"root_id": {
"bsonType": "string",
"description": "根评论ID(0表示自身是根评论)",
"defaultValue": "0",
"foreignKey": "comment._id"
},
"author_id": {
"bsonType": "string",
"description": "作者ID(关联uni-id-users表)",
"foreignKey": "uni-id-users._id"
},
"parent_author_id": {
"bsonType": "string",
"description": "回复者id(关联uni-id-users表)",
"foreignKey": "uni-id-users._id"
},
"parent_author_content": {
"bsonType": "string",
"title": "评论内容",
"minLength": 1,
"maxLength": 500,
"defaultValue":"",
"errorMessage": "评论内容不能为空且不超过500字"
},
"parent_id": {
"bsonType": "string",
"description": "父评论ID(0表示无父评论)",
"defaultValue": "0",
"foreignKey": "comment._id"
},
"article_id": {
"bsonType": "string",
"description": "关联文章ID",
"foreignKey": "uni-cms-articles._id"
},
"like_count": {
"bsonType": "int",
"description": "点赞数",
"minimum": 0,
"defaultValue": 0
},
"create_time": {
"bsonType": "timestamp",
"description": "创建时间",
"defaultValue": {
"$env": "now"
}
},
"update_time": {
"bsonType": "timestamp",
"description": "更新时间",
"defaultValue": {
"$env": "now"
}
},
"ip_location": {
"bsonType": "object",
"description": "IP信息",
"properties": {
"clientIP": {
"bsonType": "string",
"description": "客户端IP地址"
}
}
},
"reply_count": {
"bsonType": "int",
"description": "回复数",
"minimum": 0,
"defaultValue": 0
}
}
}