leave.js 1.2 KB

123456789101112131415161718192021222324252627
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 请假表
  5. const LeaveSchema = {
  6. batchid: { type: String, required: false, maxLength: 200 }, // 批次
  7. termid: { type: String, required: false, maxLength: 200 }, // 期
  8. planid: { type: String, required: false, maxLength: 200 }, // 计划
  9. studentid: { type: String, required: true, maxLength: 200 }, // 学生id
  10. starttime: { type: String, required: false, maxLength: 200 }, // 开始时间
  11. endtime: { type: String, required: false, maxLength: 500 }, // 结束时间
  12. reason: { type: String, required: false, maxLength: 2000 }, // 请假理由
  13. status: { type: String, required: false, maxLength: 200, default: '0' }, // 状态,0-审核中,1-通过,2-未通过
  14. refcause: { type: String, required: false, maxLength: 2000 }, // 拒绝原因
  15. type: { type: String, required: false, maxLength: 200 }, // 类型,0-请假,1-退出
  16. };
  17. const schema = new Schema(LeaveSchema, { toJSON: { virtuals: true } });
  18. schema.index({ id: 1 });
  19. schema.plugin(metaPlugin);
  20. module.exports = app => {
  21. const { mongoose } = app;
  22. return mongoose.model('Leave', schema, 'leave');
  23. };