patentassess.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 patentassess = {
  8. admin_id: { type: ObjectId }, // 管理员id
  9. user_id: { type: ObjectId }, // 用户id
  10. patent_id: { type: ObjectId }, // 专利id
  11. create_number: { type: String }, // 申请号
  12. patent_name: { type: String }, // 专利名称
  13. inventor: { type: Array }, // 发明人
  14. type: { type: String, required: false }, // 专利类型
  15. contact: { type: String }, // 联系人
  16. phone: { type: String }, // 联系人电话
  17. email: { type: String }, // 联系人邮箱
  18. abstract: { type: String, required: false }, // 摘要
  19. field: { type: String, required: false }, // 应用领域
  20. explain: { type: String, required: false }, // 技术说明
  21. is_money: { type: Boolean, default: false }, // 是否缴费
  22. report: { type: Array }, // 评估报告
  23. record: { type: Array }, // 记录
  24. status: { type: String, default: '0' }, // 状态
  25. remark: { type: String },
  26. };
  27. const schema = new Schema(patentassess, { toJSON: { virtuals: true } });
  28. schema.index({ id: 1 });
  29. schema.index({ admin_id: 1 });
  30. schema.index({ user_id: 1 });
  31. schema.index({ patent_id: 1 });
  32. schema.index({ create_number: 1 });
  33. schema.index({ type: 1 });
  34. schema.index({ is_money: 1 });
  35. schema.index({ 'meta.createdAt': 1 });
  36. schema.plugin(metaPlugin);
  37. module.exports = app => {
  38. const { mongoose } = app;
  39. return mongoose.model('Patentassess', schema, 'patent_assess');
  40. };