'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 patenttechol = { order_num: { type: String }, // 需求订单号 describe: { type: String }, // 需求描述(用途) urgent: { type: String }, // 紧急程度 contact: { type: String }, // 联系人 phone: { type: String }, // 联系电话 email: { type: String }, // 电子邮箱 requirement: { type: String }, // 合作条件及要求 status: { type: String }, // 状态 remark: { type: String }, }; const schema = new Schema(patenttechol, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ order_num: 1 }); schema.index({ urgent: 1 }); schema.index({ contact: 1 }); schema.index({ phone: 1 }); schema.index({ email: 1 }); schema.index({ status: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Patenttechol', schema, 'patent_techol'); };