'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 achieve_apply_expert = { expert_id: { type: ObjectId, ref: 'Achieve_expert' }, // 临时专家表的专家id apply_id: { type: ObjectId, ref: 'Achieve_apply' }, // 成果申请id verify: { type: Object }, // 评审详情:分数:score;意见:content type: { type: String }, // 工作类型:1=>评分;2=>会审 remark: { type: String, maxLength: 200 }, create_time: { type: String, default: moment().format('YYYY-MM-DD HH:mm:ss') }, }; const schema = new Schema(achieve_apply_expert, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ expert_id: 1 }); schema.index({ apply_id: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Achieve_apply_expert', schema, 'achieve_apply_expert'); };