|
@@ -3,17 +3,33 @@ const Schema = require('mongoose').Schema;
|
|
|
const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
|
|
|
|
|
|
|
|
|
+
|
|
|
+const optionInfo = new Schema({
|
|
|
+ number: { type: String, required: false, maxLength: 200 },
|
|
|
+ opname: { type: String, required: false, maxLength: 200 },
|
|
|
+});
|
|
|
+
|
|
|
+
|
|
|
+const questionInfo = {
|
|
|
+ type: { type: String, required: true, maxLength: 200 },
|
|
|
+ topic: { type: String, required: true, maxLength: 500 },
|
|
|
+ status: { type: String, required: false, maxLength: 200 },
|
|
|
+ option: { type: [ optionInfo ], select: true },
|
|
|
+};
|
|
|
+
|
|
|
|
|
|
const QuestionnaireSchema = {
|
|
|
name: { type: String, required: true, maxLength: 200 },
|
|
|
num: { type: String, required: true, maxLength: 200 },
|
|
|
type: { type: String, required: true, maxLength: 200 },
|
|
|
- question: [ String ],
|
|
|
+ status: { type: String, required: true, maxLength: 200, default: '0' },
|
|
|
+ question: { type: [ questionInfo ], required: false, select: true },
|
|
|
};
|
|
|
|
|
|
|
|
|
const schema = new Schema(QuestionnaireSchema, { toJSON: { virtuals: true } });
|
|
|
schema.index({ id: 1 });
|
|
|
+schema.index({ type: 1 });
|
|
|
schema.plugin(metaPlugin);
|
|
|
|
|
|
module.exports = app => {
|