This commit is contained in:
2025-03-21 09:38:06 +08:00
parent 8e35b74d86
commit f654e16c18
94 changed files with 22503 additions and 0 deletions
@@ -0,0 +1,37 @@
{
"bsonType": "object",
"required": ["price"], // 添加 price 为必填字段
"permission": {
"read": true,
"create": "'admin' in auth.role",
"update": "'admin' in auth.role",
"delete": "'admin' in auth.role"
},
"properties": {
"_id": {
"description": "ID,系统自动生成"
},
"url": {
"bsonType": "string",
"title": "资源地址",
"description": "带签名时效的静态资源 URL",
"trim": "both",
"pattern": "^https?://", // 基础 URL 格式校验
"errorMessage": {
"format": "URL 必须以 http/https 开头"
}
},
"price": {
"bsonType": "int",
"title": "商品价格",
"description": "单位:分(整数类型)",
"minimum": 0,
"maximum": 100000000,
"errorMessage": {
"type": "价格必须为整数类型",
"minimum": "价格不能为负数",
"maximum": "单件商品价格不得超过100万元"
}
}
}
}
@@ -0,0 +1,48 @@
{
"bsonType": "object",
"required": ["user_id", "article_id", "months", "create_time"], // 必填字段
"permission": {
"read": true,
"create": "doc._id == auth.uid || 'admin' in auth.role",
"update": "doc._id == auth.uid || 'admin' in auth.role",
"delete": "doc._id == auth.uid || 'admin' in auth.role"
},
"properties": {
"_id": {
"description": "ID,系统自动生成"
},
"months": {
"bsonType": "int",
"title": "累计月数",
"defaultValue": 0,
"minimum": 0
},
"user_id": {
"bsonType": "string",
"title": "用户ID",
"foreignKey": "uni-id-users._id",
"trim": "both",
"errorMessage": "用户ID不能为空"
},
"article_id": {
"bsonType": "string",
"title": "文章ID",
"trim": "both",
"errorMessage": "文章ID不能为空"
},
"gift_value": {
"bsonType": "int",
"title": "礼物价值",
"minimum": 0,
"defaultValue": 0,
"errorMessage": "礼物价值不能小于1"
},
"create_time": {
"bsonType": "timestamp",
"title": "创建时间",
"defaultValue": {
"$env": "now" // 自动填充服务器时间[1](@ref)
}
}
}
}