headteacher.js 1.0 KB

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 班主任表
  5. const HeadteacherSchema = {
  6. name: { type: String, required: true, maxLength: 200 }, // 姓名
  7. phone: { type: String, required: true, maxLength: 200 }, // 手机号
  8. gender: { type: String, required: false, maxLength: 200 }, // 教师性别
  9. openid: { type: String, required: false, maxLength: 200 }, // 微信openid
  10. age: { type: String, required: false, maxLength: 200 }, // 年龄
  11. birthday: { type: String, required: false, maxLength: 200 }, // 出生年月
  12. department: { type: String, required: false, maxLength: 200 }, // 所在部门
  13. islyteacher: { type: String, required: false, maxLength: 200 }, // 是否可讲礼仪课,0-否,1-是
  14. };
  15. const schema = new Schema(HeadteacherSchema, { toJSON: { virtuals: true } });
  16. schema.index({ id: 1 });
  17. schema.plugin(metaPlugin);
  18. module.exports = app => {
  19. const { mongoose } = app;
  20. return mongoose.model('Headteacher', schema, 'headteacher');
  21. };