|
@@ -0,0 +1,21 @@
|
|
|
|
+'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 tradeorder = {
|
|
|
|
+ user_id: { type: ObjectId }, // 用户id
|
|
|
|
+ content: { type: String }, // 正文内容
|
|
|
|
+ remark: { type: String },
|
|
|
|
+};
|
|
|
|
+const schema = new Schema(tradeorder, { toJSON: { virtuals: true } });
|
|
|
|
+schema.index({ id: 1 });
|
|
|
|
+schema.index({ user_id: 1 });
|
|
|
|
+schema.index({ 'meta.createdAt': 1 });
|
|
|
|
+schema.plugin(metaPlugin);
|
|
|
|
+module.exports = app => {
|
|
|
|
+ const { mongoose } = app;
|
|
|
|
+ return mongoose.model('Tradeorder', schema, 'trade_order');
|
|
|
|
+};
|