user.js 972 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 modelSchema = {
  12. // 用户名
  13. username: String,
  14. // 电子邮件
  15. email: String,
  16. // 手机号码
  17. mobile: String,
  18. // 真实姓名
  19. real_name: String,
  20. // 公司
  21. company: String,
  22. // 省份
  23. province: Number,
  24. // 公司类型
  25. company_type: {
  26. type: Number,
  27. default: -1
  28. },
  29. // 公司规模
  30. company_scale: {
  31. type: Number,
  32. default: -1
  33. },
  34. // 最后登录时间
  35. last_login: {
  36. type: Number,
  37. default: 0
  38. },
  39. // 创建时间
  40. create_time: {
  41. type: Number,
  42. default: 0
  43. },
  44. };
  45. let model = mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));
  46. export {model as default, collectionName as collectionName};