|
@@ -0,0 +1,35 @@
|
|
|
+'use strict';
|
|
|
+const Schema = require('mongoose').Schema;
|
|
|
+const moment = require('moment');
|
|
|
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
|
|
|
+const { ObjectId } = require('mongoose').Types;
|
|
|
+// 发布交易表
|
|
|
+const sell = {
|
|
|
+ user_id: { type: ObjectId }, // 用户id
|
|
|
+ create_number: { type: String }, // 申请号
|
|
|
+ name: { type: String }, // 专利名称
|
|
|
+ inventor: { type: String }, // 权利人
|
|
|
+ type: { type: String }, // 申请类型
|
|
|
+ sell_type: { type: String }, // 交易类型:许可,转移,质押
|
|
|
+ sell_money: { type: String }, // 交易金额
|
|
|
+ contacts: { type: String }, // 联系人
|
|
|
+ phone: { type: String }, // 手机号
|
|
|
+ email: { type: String }, // 邮箱
|
|
|
+ status: { type: String }, // 状态
|
|
|
+ remark: { type: String },
|
|
|
+};
|
|
|
+const schema = new Schema(sell, { toJSON: { virtuals: true } });
|
|
|
+schema.index({ id: 1 });
|
|
|
+schema.index({ user_id: 1 });
|
|
|
+schema.index({ create_number: 1 });
|
|
|
+schema.index({ name: 1 });
|
|
|
+schema.index({ type: 1 });
|
|
|
+schema.index({ sell_type: 1 });
|
|
|
+schema.index({ contacts: 1 });
|
|
|
+schema.index({ status: 1 });
|
|
|
+schema.index({ 'meta.createdAt': 1 });
|
|
|
+schema.plugin(metaPlugin);
|
|
|
+module.exports = app => {
|
|
|
+ const { mongoose } = app;
|
|
|
+ return mongoose.model('PatentSell', schema, 'patent_sell');
|
|
|
+};
|