12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- '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 patenttrans = {
- user_id: { type: ObjectId },
- admin_id: { type: ObjectId },
- patent_id: { type: ObjectId }, // 专利id
- create_number: { type: String }, // 专利号
- patent_name: { type: String }, // 专利名
- contact: { type: String }, // 联系人
- phone: { type: String }, // 联系电话
- email: { type: String }, // 电子邮箱
- budget: { type: String }, // 投资预算
- type: { type: String }, // 交易类型(转让,合作,招商,质押)
- is_report: { type: Boolean, default: false }, // 评估报告
- report: { type: Array }, // 评估报告
- requirementdesc: { type: String }, // 技术说明
- expect: { type: String }, // 预期目标
- present: { type: String }, // 需求现状
- on_obligee: { type: String }, // 变更前专利权人
- on_afterobligee: { type: String }, // 变更后专利权人
- transfer_date: { type: String }, // 专利权转移日期
- condition: { type: String }, // 合作条件及要求
- is_contract: { type: String }, // 0:线下合同,1:线上合同
- contract: { type: Object }, // 线上合同
- offine_contract: { type: Array }, // 线下合同
- record: { type: Array }, // 记录
- status: { type: String, default: '0' }, // 状态
- remark: { type: String },
- isdel: { type: String, required: false, default: '0' }, // 0=>未删除;1=>已撤回
- };
- const schema = new Schema(patenttrans, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ user_id: 1 });
- schema.index({ admin_id: 1 });
- schema.index({ patent_id: 1 });
- schema.index({ create_number: 1 });
- schema.index({ patent_name: 1 });
- schema.index({ contact: 1 });
- schema.index({ phone: 1 });
- schema.index({ email: 1 });
- schema.index({ budget: 1 });
- schema.index({ type: 1 });
- schema.index({ on_obligee: 1 });
- schema.index({ transfer_date: 1 });
- schema.index({ transfer_date: 1 });
- schema.index({ is_report: 1 });
- schema.index({ status: 1 });
- schema.index({ isdel: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Patenttrans', schema, 'patent_trans');
- };
|