disclosure.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 disclosure = {
  8. user_id: { type: ObjectId }, // 用户id
  9. admin_id: { type: ObjectId }, // 管理员id
  10. name: { type: String }, // 发明名称
  11. apply_name: { type: String }, // 申请人
  12. type: { type: String }, // 申请类型
  13. inventer: { type: String }, // 发明人
  14. contact: { type: String }, // 技术联系人
  15. phone: { type: String }, // 联系人电话
  16. email: { type: String }, // 联系人邮箱
  17. desc: { type: String }, // 特殊情况说明
  18. questions: { type: Object }, // 问题
  19. is_mech: { type: String }, // 是否需要机构
  20. mechanism_id: { type: ObjectId }, // 机构id
  21. mechanism_name: { type: String }, // 机构名称
  22. status: { type: String, default: '0' }, // 状态:0-已申请;1-机构审核;-1-机构审核未通过;2-管理员评估;-2-管理员评估未通过;3-管理员评估通过,等待上传至国家库;4-上传完成
  23. record: { type: Array }, // 记录
  24. remark: { type: String },
  25. };
  26. const schema = new Schema(disclosure, { toJSON: { virtuals: true } });
  27. schema.index({ id: 1 });
  28. schema.index({ admin_id: 1 });
  29. schema.index({ user_id: 1 });
  30. schema.index({ apply_name: 1 });
  31. schema.index({ name: 1 });
  32. schema.index({ status: 1 });
  33. schema.index({ is_mech: 1 });
  34. schema.index({ mechanism_id: 1 });
  35. schema.index({ mechanism_name: 1 });
  36. schema.index({ 'meta.createdAt': 1 });
  37. schema.plugin(metaPlugin);
  38. module.exports = app => {
  39. const { mongoose } = app;
  40. return mongoose.model('Disclosure', schema, 'disclosure');
  41. };