'use strict'; const Schema = require('mongoose').Schema; const moment = require('moment'); const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); const { ObjectId } = require('mongoose').Types; // 价值评估表 const patentassess = { admin_id: { type: ObjectId }, // 管理员id user_id: { type: ObjectId }, // 用户id patent_id: { type: ObjectId }, // 专利id create_number: { type: String }, // 申请号 patent_name: { type: String }, // 专利名称 inventor: { type: Array }, // 发明人 type: { type: String, required: false }, // 专利类型 contact: { type: String }, // 联系人 phone: { type: String }, // 联系人电话 email: { type: String }, // 联系人邮箱 abstract: { type: String, required: false }, // 摘要 field: { type: String, required: false }, // 应用领域 explain: { type: String, required: false }, // 技术说明 is_money: { type: Boolean, default: false }, // 是否缴费 report: { type: Array }, // 评估报告 record: { type: Array }, // 记录 status: { type: String, default: '0' }, // 状态 remark: { type: String }, }; const schema = new Schema(patentassess, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ admin_id: 1 }); schema.index({ user_id: 1 }); schema.index({ patent_id: 1 }); schema.index({ create_number: 1 }); schema.index({ type: 1 }); schema.index({ is_money: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Patentassess', schema, 'patent_assess'); };