uni-id-users.schema.json 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. {
  2. "bsonType": "object",
  3. "required": ["username", "password"],
  4. "permission": {
  5. "read": true,
  6. "create": "'CREATE_UNI_ID_USERS' in auth.permission",
  7. "update": "doc._id == auth.uid || 'UPDATE_UNI_ID_USERS' in auth.permission",
  8. "delete": "'DELETE_UNI_ID_USERS' in auth.permission"
  9. },
  10. "properties": {
  11. "_id": {
  12. "description": "存储文档 ID(用户 ID),系统自动生成"
  13. },
  14. "ali_openid": {
  15. "bsonType": "string",
  16. "description": "支付宝平台openid",
  17. "permission": {
  18. "write": false,
  19. "read": "doc._id == auth.uid"
  20. }
  21. },
  22. "apple_openid": {
  23. "bsonType": "string",
  24. "description": "苹果登录openid",
  25. "permission": {
  26. "write": false,
  27. "read": "doc._id == auth.uid"
  28. }
  29. },
  30. "avatar": {
  31. "bsonType": "string",
  32. "description": "头像地址",
  33. "title": "头像地址",
  34. "trim": "both"
  35. },
  36. "avatar_file": {
  37. "bsonType": "file",
  38. "description": "用file类型方便使用uni-file-picker组件",
  39. "title": "头像文件"
  40. },
  41. "comment": {
  42. "bsonType": "string",
  43. "description": "备注",
  44. "title": "备注",
  45. "trim": "both",
  46. "permission": {
  47. "write": false,
  48. "read": false
  49. }
  50. },
  51. "dcloud_appid": {
  52. "bsonType": "array",
  53. "description": "允许登录的客户端的appid列表",
  54. "foreignKey": "opendb-app-list.appid",
  55. "permission": {
  56. "write": false,
  57. "read": "doc._id == auth.uid"
  58. }
  59. },
  60. "department_id": {
  61. "bsonType": "array",
  62. "description": "部门ID",
  63. "enum": {
  64. "collection": "opendb-department",
  65. "field": "_id as value, name as text",
  66. "orderby": "name asc"
  67. },
  68. "enumType": "tree",
  69. "title": "部门",
  70. "permission": {
  71. "write": false,
  72. "read": "doc._id == auth.uid"
  73. }
  74. },
  75. "email": {
  76. "bsonType": "string",
  77. "description": "邮箱地址",
  78. "format": "email",
  79. "title": "邮箱",
  80. "trim": "both",
  81. "permission": {
  82. "write": false,
  83. "read": "doc._id == auth.uid"
  84. }
  85. },
  86. "email_confirmed": {
  87. "bsonType": "int",
  88. "defaultValue": 0,
  89. "description": "邮箱验证状态:0 未验证 1 已验证",
  90. "enum": [{
  91. "text": "未验证",
  92. "value": 0
  93. },
  94. {
  95. "text": "已验证",
  96. "value": 1
  97. }
  98. ],
  99. "title": "邮箱验证状态",
  100. "permission": {
  101. "write": false,
  102. "read": "doc._id == auth.uid"
  103. }
  104. },
  105. "gender": {
  106. "bsonType": "int",
  107. "defaultValue": 0,
  108. "description": "用户性别:0 未知 1 男性 2 女性",
  109. "enum": [{
  110. "text": "未知",
  111. "value": 0
  112. },
  113. {
  114. "text": "男",
  115. "value": 1
  116. },
  117. {
  118. "text": "女",
  119. "value": 2
  120. }
  121. ],
  122. "title": "性别",
  123. "permission": {
  124. "write": false,
  125. "read": "doc._id == auth.uid"
  126. }
  127. },
  128. "invite_time": {
  129. "bsonType": "timestamp",
  130. "description": "受邀时间",
  131. "permission": {
  132. "write": false,
  133. "read": "doc._id == auth.uid"
  134. }
  135. },
  136. "inviter_uid": {
  137. "bsonType": "array",
  138. "description": "用户全部上级邀请者",
  139. "trim": "both",
  140. "permission": {
  141. "write": false,
  142. "read": "doc._id == auth.uid"
  143. }
  144. },
  145. "last_login_date": {
  146. "bsonType": "timestamp",
  147. "description": "最后登录时间",
  148. "permission": {
  149. "write": false,
  150. "read": "doc._id == auth.uid"
  151. }
  152. },
  153. "last_login_ip": {
  154. "bsonType": "string",
  155. "description": "最后登录时 IP 地址",
  156. "permission": {
  157. "write": false,
  158. "read": "doc._id == auth.uid"
  159. }
  160. },
  161. "mobile": {
  162. "bsonType": "string",
  163. "description": "手机号码",
  164. "pattern": "^\\+?[0-9-]{3,20}$",
  165. "title": "手机号码",
  166. "trim": "both",
  167. "permission": {
  168. "write": false,
  169. "read": "doc._id == auth.uid"
  170. }
  171. },
  172. "mobile_confirmed": {
  173. "bsonType": "int",
  174. "defaultValue": 0,
  175. "description": "手机号验证状态:0 未验证 1 已验证",
  176. "enum": [{
  177. "text": "未验证",
  178. "value": 0
  179. },
  180. {
  181. "text": "已验证",
  182. "value": 1
  183. }
  184. ],
  185. "title": "手机号验证状态",
  186. "permission": {
  187. "write": false,
  188. "read": "doc._id == auth.uid"
  189. }
  190. },
  191. "my_invite_code": {
  192. "bsonType": "string",
  193. "description": "用户自身邀请码",
  194. "permission": {
  195. "write": false,
  196. "read": "doc._id == auth.uid"
  197. }
  198. },
  199. "nickname": {
  200. "bsonType": "string",
  201. "description": "用户昵称",
  202. "title": "昵称",
  203. "trim": "both"
  204. },
  205. "password": {
  206. "bsonType": "password",
  207. "description": "密码,加密存储",
  208. "title": "密码",
  209. "trim": "both",
  210. "permission": {
  211. "write": false,
  212. "read": false
  213. }
  214. },
  215. "password_secret_version": {
  216. "bsonType": "int",
  217. "description": "密码使用的passwordSecret版本",
  218. "title": "passwordSecret",
  219. "permission": {
  220. "write": false,
  221. "read": false
  222. }
  223. },
  224. "realname_auth": {
  225. "bsonType": "object",
  226. "description": "实名认证信息",
  227. "permission": {
  228. "write": false,
  229. "read": "doc._id == auth.uid"
  230. },
  231. "properties": {
  232. "auth_date": {
  233. "bsonType": "timestamp",
  234. "description": "认证通过时间"
  235. },
  236. "auth_status": {
  237. "bsonType": "int",
  238. "description": "认证状态:0 未认证 1 等待认证 2 认证通过 3 认证失败",
  239. "maximum": 3,
  240. "minimum": 0
  241. },
  242. "contact_email": {
  243. "bsonType": "string",
  244. "description": "联系人邮箱"
  245. },
  246. "contact_mobile": {
  247. "bsonType": "string",
  248. "description": "联系人手机号码"
  249. },
  250. "contact_person": {
  251. "bsonType": "string",
  252. "description": "联系人姓名"
  253. },
  254. "id_card_back": {
  255. "bsonType": "string",
  256. "description": "身份证反面照 URL"
  257. },
  258. "id_card_front": {
  259. "bsonType": "string",
  260. "description": "身份证正面照 URL"
  261. },
  262. "identity": {
  263. "bsonType": "string",
  264. "description": "身份证号码/营业执照号码"
  265. },
  266. "in_hand": {
  267. "bsonType": "string",
  268. "description": "手持身份证照片 URL"
  269. },
  270. "license": {
  271. "bsonType": "string",
  272. "description": "营业执照 URL"
  273. },
  274. "real_name": {
  275. "bsonType": "string",
  276. "description": "真实姓名/企业名称"
  277. },
  278. "type": {
  279. "bsonType": "int",
  280. "description": "用户类型:0 个人用户 1 企业用户",
  281. "maximum": 1,
  282. "minimum": 0
  283. }
  284. },
  285. "required": [
  286. "type",
  287. "auth_status"
  288. ]
  289. },
  290. "register_date": {
  291. "bsonType": "timestamp",
  292. "description": "注册时间",
  293. "forceDefaultValue": {
  294. "$env": "now",
  295. "read": "doc._id == auth.uid"
  296. }
  297. },
  298. "register_ip": {
  299. "bsonType": "string",
  300. "description": "注册时 IP 地址",
  301. "forceDefaultValue": {
  302. "$env": "clientIP",
  303. "read": "doc._id == auth.uid"
  304. }
  305. },
  306. "role": {
  307. "bsonType": "array",
  308. "description": "用户角色",
  309. "enum": {
  310. "collection": "uni-id-roles",
  311. "field": "role_id as value, role_name as text"
  312. },
  313. "foreignKey": "uni-id-roles.role_id",
  314. "permission": {
  315. "write": false,
  316. "read": "doc._id == auth.uid"
  317. },
  318. "title": "角色"
  319. },
  320. "score": {
  321. "bsonType": "int",
  322. "description": "用户积分,积分变更记录可参考:uni-id-scores表定义",
  323. "permission": {
  324. "write": false,
  325. "read": "doc._id == auth.uid"
  326. }
  327. },
  328. "status": {
  329. "bsonType": "int",
  330. "defaultValue": 0,
  331. "description": "用户状态:0 正常 1 禁用 2 审核中 3 审核拒绝",
  332. "permission": {
  333. "write": false,
  334. "read": "doc._id == auth.uid"
  335. },
  336. "enum": [{
  337. "text": "正常",
  338. "value": 0
  339. },
  340. {
  341. "text": "禁用",
  342. "value": 1
  343. },
  344. {
  345. "text": "审核中",
  346. "value": 2
  347. },
  348. {
  349. "text": "审核拒绝",
  350. "value": 3
  351. }
  352. ],
  353. "title": "用户状态"
  354. },
  355. "token": {
  356. "bsonType": "array",
  357. "description": "用户token",
  358. "permission": {
  359. "read": "doc._id == auth.uid"
  360. }
  361. },
  362. "username": {
  363. "bsonType": "string",
  364. "description": "用户名,不允许重复",
  365. "title": "用户名",
  366. "trim": "both",
  367. "permission": {
  368. "write": false
  369. }
  370. },
  371. "wx_openid": {
  372. "bsonType": "object",
  373. "description": "微信各个平台openid",
  374. "properties": {
  375. "app": {
  376. "bsonType": "string",
  377. "description": "app平台微信openid"
  378. },
  379. "mp": {
  380. "bsonType": "string",
  381. "description": "微信小程序平台openid"
  382. },
  383. "h5": {
  384. "bsonType": "string",
  385. "description": "微信公众号登录openid"
  386. },
  387. "web": {
  388. "bsonType": "string",
  389. "description": "PC页面扫码登录openid"
  390. }
  391. },
  392. "permission": {
  393. "write": false,
  394. "read": "doc._id == auth.uid"
  395. }
  396. },
  397. "wx_unionid": {
  398. "bsonType": "string",
  399. "description": "微信unionid",
  400. "permission": {
  401. "write": false,
  402. "read": "doc._id == auth.uid"
  403. }
  404. },
  405. "qq_openid": {
  406. "bsonType": "object",
  407. "description": "QQ各个平台openid",
  408. "properties": {
  409. "app": {
  410. "bsonType": "string",
  411. "description": "app平台QQ openid"
  412. },
  413. "mp": {
  414. "bsonType": "string",
  415. "description": "QQ小程序平台openid"
  416. }
  417. },
  418. "permission": {
  419. "write": false,
  420. "read": "doc._id == auth.uid"
  421. }
  422. },
  423. "qq_unionid": {
  424. "bsonType": "string",
  425. "description": "QQ unionid",
  426. "permission": {
  427. "write": false,
  428. "read": "doc._id == auth.uid"
  429. }
  430. }
  431. }
  432. }