patenttrans.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. // 专利交易表
  7. const patenttrans = {
  8. user_id: { type: ObjectId },
  9. admin_id: { type: ObjectId },
  10. patent_id: { type: ObjectId }, // 专利id
  11. create_number: { type: String }, // 专利号
  12. patent_name: { type: String }, // 专利名
  13. contact: { type: String }, // 联系人
  14. phone: { type: String }, // 联系电话
  15. email: { type: String }, // 电子邮箱
  16. budget: { type: String }, // 投资预算
  17. type: { type: String }, // 交易类型(转让,合作,招商,质押)
  18. is_report: { type: Boolean, default: false }, // 评估报告
  19. report: { type: Array }, // 评估报告
  20. requirementdesc: { type: String }, // 技术说明
  21. expect: { type: String }, // 预期目标
  22. present: { type: String }, // 需求现状
  23. on_obligee: { type: String }, // 变更前专利权人
  24. on_afterobligee: { type: String }, // 变更后专利权人
  25. transfer_date: { type: String }, // 专利权转移日期
  26. condition: { type: String }, // 合作条件及要求
  27. is_contract: { type: String }, // 0:线下合同,1:线上合同
  28. contract: { type: Object }, // 线上合同
  29. offine_contract: { type: Array }, // 线下合同
  30. record: { type: Array }, // 记录
  31. status: { type: String, default: '0' }, // 状态
  32. remark: { type: String },
  33. isdel: { type: String, required: false, default: '0' }, // 0=>未删除;1=>已撤回
  34. };
  35. const schema = new Schema(patenttrans, { toJSON: { virtuals: true } });
  36. schema.index({ id: 1 });
  37. schema.index({ user_id: 1 });
  38. schema.index({ admin_id: 1 });
  39. schema.index({ patent_id: 1 });
  40. schema.index({ create_number: 1 });
  41. schema.index({ patent_name: 1 });
  42. schema.index({ contact: 1 });
  43. schema.index({ phone: 1 });
  44. schema.index({ email: 1 });
  45. schema.index({ budget: 1 });
  46. schema.index({ type: 1 });
  47. schema.index({ on_obligee: 1 });
  48. schema.index({ transfer_date: 1 });
  49. schema.index({ transfer_date: 1 });
  50. schema.index({ is_report: 1 });
  51. schema.index({ status: 1 });
  52. schema.index({ isdel: 1 });
  53. schema.index({ 'meta.createdAt': 1 });
  54. schema.plugin(metaPlugin);
  55. module.exports = app => {
  56. const { mongoose } = app;
  57. return mongoose.model('Patenttrans', schema, 'patent_trans');
  58. };