patentsafeg.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. // 专利维权-维权委托书
  7. const patentsafeg = {
  8. user_id: { type: ObjectId }, // 用户id
  9. admin_id: { type: ObjectId }, // 管理员id
  10. create_number: { type: String }, // 申请号
  11. name: { type: String }, // 发明名称
  12. apply_personal: { type: String }, // 申请人
  13. type: { type: String }, // 申请类型
  14. inventor: { type: String }, // 发明人
  15. contact: { type: String }, // 联系人
  16. phone: { type: String }, // 联系人电话
  17. email: { type: String }, // 联系人邮箱
  18. questions: { type: Object }, // 问题
  19. file: { type: Array }, // 报告文件
  20. record: { type: Array }, // 记录
  21. status: { type: String, default: '0' }, // 状态
  22. remark: { type: String },
  23. };
  24. const schema = new Schema(patentsafeg, { toJSON: { virtuals: true } });
  25. schema.index({ id: 1 });
  26. schema.index({ user_id: 1 });
  27. schema.index({ admin_id: 1 });
  28. schema.index({ create_number: 1 });
  29. schema.index({ status: 1 });
  30. schema.index({ 'meta.createdAt': 1 });
  31. schema.plugin(metaPlugin);
  32. module.exports = app => {
  33. const { mongoose } = app;
  34. return mongoose.model('Patentsafeg', schema, 'patent_safeg');
  35. };