talented.js 743 B

12345678910111213141516171819202122
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 科目表
  5. const TalentedSchema = {
  6. planid: { type: String, required: false }, // 计划id
  7. termid: { type: String, required: false }, // 期id
  8. batchid: { type: String, required: false }, // 批次id
  9. classid: { type: String, ref: 'Class' }, // 班级id
  10. studentid: { type: String, ref: 'Student' }, // 学生id
  11. files: { type: Array }, // 文件列表
  12. };
  13. const schema = new Schema(TalentedSchema, { toJSON: { virtuals: true } });
  14. schema.index({ id: 1 });
  15. schema.plugin(metaPlugin);
  16. module.exports = app => {
  17. const { mongoose } = app;
  18. return mongoose.model('Talented', schema, 'talented');
  19. };