|
@@ -0,0 +1,30 @@
|
|
|
|
+'use strict';
|
|
|
|
+const Schema = require('mongoose').Schema;
|
|
|
|
+const moment = require('moment');
|
|
|
|
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
|
|
|
|
+const { Secret } = require('naf-framework-mongoose/lib/model/schema');
|
|
|
|
+const { ObjectId } = require('mongoose').Types;
|
|
|
|
+// 专利资讯服务房间表
|
|
|
|
+const patentroom = {
|
|
|
|
+ time_id: { type: ObjectId }, // 时间id
|
|
|
|
+ p1_id: { type: ObjectId, required: true }, // 第一个人id
|
|
|
|
+ p1: { type: String, required: false }, // 第一个人名
|
|
|
|
+ p2_id: { type: ObjectId, required: true }, // 第二个人id
|
|
|
|
+ p2: { type: String, required: false }, // 第二个人名
|
|
|
|
+ create_time: {
|
|
|
|
+ type: String,
|
|
|
|
+ default: moment().format('YYYY-MM-DD HH:mm:ss'),
|
|
|
|
+ },
|
|
|
|
+ last_time: { type: String }, // 最后发言时间
|
|
|
|
+};
|
|
|
|
+const schema = new Schema(patentroom, { toJSON: { virtuals: true } });
|
|
|
|
+schema.index({ id: 1 });
|
|
|
|
+schema.index({ time_id: 1 });
|
|
|
|
+schema.index({ p1_id: 1 });
|
|
|
|
+schema.index({ p2_id: 1 });
|
|
|
|
+schema.index({ 'meta.createdAt': 1 });
|
|
|
|
+schema.plugin(metaPlugin);
|
|
|
|
+module.exports = app => {
|
|
|
|
+ const { mongoose } = app;
|
|
|
|
+ return mongoose.model('Patentroom', schema, 'patent_room');
|
|
|
|
+};
|