|
@@ -0,0 +1,36 @@
|
|
|
|
+'use strict';
|
|
|
|
+const Schema = require('mongoose').Schema;
|
|
|
|
+const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
|
|
|
|
+
|
|
|
|
+// 问题咨询
|
|
|
|
+const problem = {
|
|
|
|
+ name: { type: String, required: false }, // 问题名称
|
|
|
|
+ ask_id: { type: String, required: false }, // 发问人id
|
|
|
|
+ ask_name: { type: String, required: false }, // 发问人姓名
|
|
|
|
+ ask_date: { type: String, required: false }, // 发问时间
|
|
|
|
+ ask_explain: { type: String, required: false }, // 问题说明
|
|
|
|
+ ask_file: { type: Array, required: false }, // 问题文件
|
|
|
|
+ answer_id: { type: String, required: false }, // 答题人id
|
|
|
|
+ answer_name: { type: String, required: false }, // 答题人姓名
|
|
|
|
+ answer_date: { type: String, required: false }, // 答题时间
|
|
|
|
+ answer_explain: { type: String, required: false }, // 答题说明
|
|
|
|
+ answer_file: { type: Array, required: false }, // 答题文件
|
|
|
|
+ status: { type: String, required: false, default: '0' }, // 状态:0:待审,1:已分配,2:已回答,3:已发送答案,4:已阅读
|
|
|
|
+};
|
|
|
|
+const schema = new Schema(problem, { toJSON: { virtuals: true } });
|
|
|
|
+schema.index({ id: 1 });
|
|
|
|
+schema.index({ 'meta.createdAt': 1 });
|
|
|
|
+schema.index({ name: 1 });
|
|
|
|
+schema.index({ ask_id: 1 });
|
|
|
|
+schema.index({ ask_name: 1 });
|
|
|
|
+schema.index({ ask_date: 1 });
|
|
|
|
+schema.index({ answer_id: 1 });
|
|
|
|
+schema.index({ answer_name: 1 });
|
|
|
|
+schema.index({ answer_date: 1 });
|
|
|
|
+schema.index({ status: 1 });
|
|
|
|
+
|
|
|
|
+schema.plugin(metaPlugin);
|
|
|
|
+module.exports = app => {
|
|
|
|
+ const { mongoose } = app;
|
|
|
|
+ return mongoose.model('Problem', schema, 'problem');
|
|
|
|
+};
|