setting.js 1.5 KB

123456789101112131415161718192021222324252627282930
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 设置表
  5. const SettingSchema = {
  6. planyearid: { type: String, required: false, maxLength: 100 }, // 默认大批次id
  7. planid: { type: String, required: false, maxLength: 100 }, // 默认年度计划id
  8. termid: { type: String, required: false, maxLength: 100 }, // 默认期id
  9. user_email: { type: String, required: false, maxLength: 100 }, // 服务器邮箱
  10. auth_code: { type: String, required: false, maxLength: 100 }, // 服务器邮箱授权码
  11. am_start: { type: String, required: false, maxLength: 20 }, // 上午考勤开始时间
  12. am_end: { type: String, required: false, maxLength: 20 }, // 上午考勤结束时间
  13. pm_start: { type: String, required: false, maxLength: 20 }, // 下午开始时间
  14. pm_end: { type: String, required: false, maxLength: 20 }, // 下午结束时间
  15. bd_start: { type: String, required: false, maxLength: 20 }, // 寝室开始时间
  16. bd_end: { type: String, required: false, maxLength: 20 }, // 寝室结束时间
  17. ques_setting: { type: [ Object ], required: false, maxLength: 1000 }, // 问卷设置默认导出字段
  18. template_term: { type: String, required: false }, // 默认期模板
  19. };
  20. const schema = new Schema(SettingSchema, { toJSON: { virtuals: true } });
  21. schema.index({ id: 1 });
  22. schema.plugin(metaPlugin);
  23. module.exports = app => {
  24. const { mongoose } = app;
  25. return mongoose.model('Setting', schema, 'setting');
  26. };