student.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 学生表
  5. const StudentSchema = {
  6. name: { type: String, required: true, maxLength: 200 }, // 姓名
  7. id_number: { type: String, required: true, maxLength: 200 }, // 身份证号
  8. phone: { type: String, required: true, maxLength: 200 }, // 手机号
  9. gender: { type: String, required: false, maxLength: 200 }, // 性别
  10. nation: { type: String, required: false, maxLength: 200 }, // 民族
  11. school_name: { type: String, required: false, maxLength: 200 }, // 学校名称
  12. major: { type: String, required: false, maxLength: 200 }, // 专业
  13. entry_year: { type: String, required: false, maxLength: 200 }, // 入学年份
  14. finish_year: { type: String, required: false, maxLength: 200 }, // 毕业年份
  15. school_job: { type: String, required: false, maxLength: 200 }, // 在校担任何种职务
  16. qq: { type: String, required: false, maxLength: 200 }, // QQ号
  17. email: { type: String, required: false, maxLength: 200 }, // 邮箱
  18. openid: { type: String, required: false, maxLength: 200 }, // 微信openid
  19. family_place: { type: String, required: false, maxLength: 200 }, // 家庭所在地
  20. family_is_hard: { type: String, required: false, maxLength: 200 }, // 家庭是否困难,0-否,1-是
  21. have_grant: { type: String, required: false, maxLength: 200 }, // 是否获得过助学金,0-否,1-是
  22. job: { type: String, required: false, maxLength: 200 }, // 职务
  23. term: { type: String, required: false, maxLength: 200 }, // 期
  24. batch: { type: String, required: false, maxLength: 200 }, // 批次
  25. class: { type: String, required: false, maxLength: 200 }, // 班级
  26. is_fine: { type: String, required: false, maxLength: 200 }, // 是否优秀,0-否,1-是
  27. }
  28. ;
  29. const schema = new Schema(StudentSchema, { toJSON: { virtuals: true } });
  30. schema.index({ id: 1 });
  31. schema.plugin(metaPlugin);
  32. module.exports = app => {
  33. const { mongoose } = app;
  34. return mongoose.model('Student', schema, 'student');
  35. };