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