termquest.js 547 B

12345678910111213141516171819
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 每期可答问卷表
  5. const TermquestSchema = {
  6. termid: { type: String, required: true, maxLength: 200 }, // 期id
  7. questionnaireid: [ String ], // 问卷id
  8. };
  9. const schema = new Schema(TermquestSchema, { toJSON: { virtuals: true } });
  10. schema.index({ id: 1 });
  11. schema.plugin(metaPlugin);
  12. module.exports = app => {
  13. const { mongoose } = app;
  14. return mongoose.model('Termquest', schema, 'termquest');
  15. };