analysis.js 1.2 KB

123456789101112131415161718192021222324252627
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
  4. // 查新检索
  5. const analysis = {
  6. name: { type: String, required: false }, // 发明名称
  7. user_id: { type: String, required: false }, // 申请人id
  8. user_name: { type: String, required: false }, // 申请人姓名
  9. type: { type: String, required: false }, // 专利类型
  10. inventor: { type: String, required: false }, // 发明人
  11. contact: { type: String, required: false }, // 技术联系人
  12. phone: { type: String, required: false }, // 联系电话
  13. email: { type: String, required: false }, // 电子邮箱
  14. questions: { type: Array, required: false }, // 其他内容合集
  15. file: { type: Array, required: false }, // 报告文件
  16. status: { type: String, required: false }, // 状态:0:待审中,1:审核通过,待发报告文件,-1:审核未通过,2:文件已发,请及时下载
  17. };
  18. const schema = new Schema(analysis, { toJSON: { virtuals: true } });
  19. schema.index({ id: 1 });
  20. schema.index({ 'meta.createdAt': 1 });
  21. schema.plugin(metaPlugin);
  22. module.exports = app => {
  23. const { mongoose } = app;
  24. return mongoose.model('Analysis', schema, 'analysis');
  25. };