user.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. deadline: {
  17. type:String,
  18. default: '',
  19. },
  20. }, { _id: false })
  21. let modelSchema = {
  22. // 用户名
  23. username: String,
  24. // 电子邮件
  25. email: String,
  26. // 手机号码
  27. mobile: String,
  28. // qq号码
  29. qq: {
  30. type: String,
  31. default: ''
  32. },
  33. // 真实姓名
  34. real_name: String,
  35. // 公司
  36. company: String,
  37. // 省份
  38. province: Number,
  39. // 公司类型
  40. company_type: {
  41. type: Number,
  42. default: -1
  43. },
  44. // 公司规模
  45. company_scale: {
  46. type: Number,
  47. default: -1
  48. },
  49. // 最后登录时间
  50. latest_login: {
  51. type: Number,
  52. default: 0
  53. },
  54. //最近使用编办
  55. latest_used:String,
  56. // 创建时间
  57. create_time: {
  58. type: Number,
  59. default: 0
  60. },
  61. upgrade_list:[upgrade],
  62. user_type:{
  63. type:String,
  64. default:'normal'// normal : 普通用户,test:测试用户
  65. }
  66. };
  67. mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));