123456789101112131415161718192021222324 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 请假表
- const LeaveSchema = {
- studentid: { type: String, required: true, maxLength: 200 }, // 学生id
- starttime: { type: String, required: false, maxLength: 200 }, // 开始时间
- endtime: { type: String, required: false, maxLength: 500 }, // 结束时间
- reason: { type: String, required: false, maxLength: 2000 }, // 请假理由
- status: { type: String, required: false, maxLength: 200, default: '0' }, // 状态,0-审核中,1-通过,2-未通过
- refcause: { type: String, required: false, maxLength: 2000 }, // 拒绝原因
- type: { type: String, required: false, maxLength: 200 }, // 类型,0-请假,1-退出
- };
- const schema = new Schema(LeaveSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Leave', schema, 'leave');
- };
|