uni-cms-articles.schema.json 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. {
  2. "bsonType": "object",
  3. "required": ["user_id", "title", "content"],
  4. "permission": {
  5. "read": true,
  6. "create": "'admin' in auth.role || 'CREATE_UNI_CMS_ARTICLE' in auth.permission",
  7. "update": "'admin' in auth.role || 'UPDATE_UNI_CMS_ARTICLE' in auth.permission",
  8. "delete": "'admin' in auth.role || 'DELETE_UNI_CMS_ARTICLE' in auth.permission"
  9. },
  10. "properties": {
  11. "_id": {
  12. "description": "存储文档 ID(用户 ID),系统自动生成"
  13. },
  14. "user_id": {
  15. "bsonType": "string",
  16. "description": "文章作者ID, 参考`uni-id-users` 表",
  17. "foreignKey": "uni-id-users._id",
  18. "defaultValue": {
  19. "$env": "uid"
  20. }
  21. },
  22. "category_id": {
  23. "bsonType": "string",
  24. "title": "分类",
  25. "description": "分类 id,参考`uni-news-categories`表",
  26. "foreignKey": "uni-cms-categories._id",
  27. "enum": {
  28. "collection": "uni-cms-categories",
  29. "field": "name as text, _id as value"
  30. }
  31. },
  32. "title": {
  33. "bsonType": "string",
  34. "title": "标题",
  35. "description": "标题",
  36. "label": "标题",
  37. "trim": "both"
  38. },
  39. "content": {
  40. "bsonType": "object",
  41. "title": "文章内容",
  42. "description": "文章内容; 格式为Quill编辑器的Delta格式",
  43. "label": "文章内容"
  44. },
  45. "excerpt": {
  46. "bsonType": "string",
  47. "title": "文章摘录",
  48. "description": "文章摘录",
  49. "label": "摘要",
  50. "trim": "both"
  51. },
  52. "article_status": {
  53. "bsonType": "int",
  54. "title": "文章状态",
  55. "description": "文章状态:0 草稿箱 1 已发布",
  56. "defaultValue": 0,
  57. "enum": [{
  58. "value": 0,
  59. "text": "草稿箱"
  60. },
  61. {
  62. "value": 1,
  63. "text": "已发布"
  64. }
  65. ]
  66. },
  67. "view_count": {
  68. "bsonType": "int",
  69. "title": "阅读数量",
  70. "description": "阅读数量",
  71. "defaultValue": 0,
  72. "permission": {
  73. "write": false
  74. }
  75. },
  76. "like_count": {
  77. "bsonType": "int",
  78. "description": "喜欢数、点赞数",
  79. "permission": {
  80. "write": false
  81. }
  82. },
  83. "is_sticky": {
  84. "bsonType": "bool",
  85. "title": "是否置顶",
  86. "description": "是否置顶",
  87. "permission": {
  88. "write": false
  89. }
  90. },
  91. "is_essence": {
  92. "bsonType": "bool",
  93. "title": "阅读加精",
  94. "description": "阅读加精",
  95. "permission": {
  96. "write": false
  97. }
  98. },
  99. "comment_status": {
  100. "bsonType": "int",
  101. "title": "开放评论",
  102. "description": "评论状态:0 关闭 1 开放",
  103. "enum": [{
  104. "value": 0,
  105. "text": "关闭"
  106. },
  107. {
  108. "value": 1,
  109. "text": "开放"
  110. }
  111. ]
  112. },
  113. "comment_count": {
  114. "bsonType": "int",
  115. "description": "评论数量",
  116. "permission": {
  117. "write": false
  118. }
  119. },
  120. "last_comment_user_id": {
  121. "bsonType": "string",
  122. "description": "最后回复用户 id,参考`uni-id-users` 表",
  123. "foreignKey": "uni-id-users._id"
  124. },
  125. "thumbnail": {
  126. "bsonType": "array",
  127. "title": "封面大图",
  128. "description": "缩略图地址",
  129. "label": "封面大图",
  130. "defaultValue": []
  131. },
  132. "publish_date": {
  133. "bsonType": "timestamp",
  134. "title": "发表时间",
  135. "description": "发表时间",
  136. "defaultValue": {
  137. "$env": "now"
  138. }
  139. },
  140. "publish_ip": {
  141. "bsonType": "string",
  142. "title": "发布文章时IP地址",
  143. "description": "发表时 IP 地址",
  144. "forceDefaultValue": {
  145. "$env": "clientIP"
  146. }
  147. },
  148. "last_modify_date": {
  149. "bsonType": "timestamp",
  150. "title": "最后修改时间",
  151. "description": "最后修改时间",
  152. "defaultValue": {
  153. "$env": "now"
  154. }
  155. },
  156. "last_modify_ip": {
  157. "bsonType": "string",
  158. "description": "最后修改时 IP 地址",
  159. "forceDefaultValue": {
  160. "$env": "clientIP"
  161. }
  162. },
  163. "preview_secret": {
  164. "bsonType": "string",
  165. "description": "文章预览密钥"
  166. },
  167. "preview_expired": {
  168. "bsonType": "timestamp",
  169. "description": "文章预览过期时间"
  170. }
  171. }
  172. }