user.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /**
  2. * 用户数据模型
  3. *
  4. * @author CaiAoLin
  5. * @date 2017/7/20
  6. * @version
  7. */
  8. import mongoose from "mongoose";
  9. let Schema = mongoose.Schema;
  10. let collectionName = 'users';
  11. let upgrade = mongoose.Schema({
  12. compilationID:String,//编办ID
  13. upgrade_time:Number,
  14. isUpgrade:Boolean,
  15. remark:String//描述:广东办刘飞 2018-06-17 启用/关闭
  16. }, { _id: false })
  17. let modelSchema = {
  18. // 用户名
  19. username: String,
  20. // 电子邮件
  21. email: String,
  22. // 手机号码
  23. mobile: String,
  24. // qq号码
  25. qq: {
  26. type: String,
  27. default: ''
  28. },
  29. // 真实姓名
  30. real_name: String,
  31. // 公司
  32. company: String,
  33. // 省份
  34. province: Number,
  35. // 公司类型
  36. company_type: {
  37. type: Number,
  38. default: -1
  39. },
  40. // 公司规模
  41. company_scale: {
  42. type: Number,
  43. default: -1
  44. },
  45. // 最后登录时间
  46. latest_login: {
  47. type: Number,
  48. default: 0
  49. },
  50. //最近使用编办
  51. latest_used:String,
  52. // 创建时间
  53. create_time: {
  54. type: Number,
  55. default: 0
  56. },
  57. upgrade_list:[upgrade],
  58. user_type:{
  59. type:String,
  60. default:'normal'// normal : 普通用户,test:测试用户
  61. }
  62. };
  63. mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));