achieve_apply_expert.js 1.0 KB

123456789101112131415161718192021222324
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. // 专家分配的申请表
  7. const achieve_apply_expert = {
  8. expert_id: { type: ObjectId, ref: 'Achieve_expert' }, // 临时专家表的专家id
  9. apply_id: { type: ObjectId, ref: 'Achieve_apply' }, // 成果申请id
  10. verify: { type: Object }, // 评审详情:分数:score;意见:content
  11. type: { type: String }, // 工作类型:1=>评分;2=>会审
  12. remark: { type: String, maxLength: 200 },
  13. create_time: { type: String, default: moment().format('YYYY-MM-DD HH:mm:ss') },
  14. };
  15. const schema = new Schema(achieve_apply_expert, { toJSON: { virtuals: true } });
  16. schema.index({ id: 1 });
  17. schema.index({ expert_id: 1 });
  18. schema.index({ apply_id: 1 });
  19. schema.index({ 'meta.createdAt': 1 });
  20. schema.plugin(metaPlugin);
  21. module.exports = app => {
  22. const { mongoose } = app;
  23. return mongoose.model('Achieve_apply_expert', schema, 'achieve_apply_expert');
  24. };