duplicate.js 1001 B

12345678910111213141516171819202122232425
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. // 绩效审核通过表(生成副本)
  7. const duplicate = {
  8. apply_id: { type: String }, // 原数据id
  9. user_id: { type: String }, // 用户id
  10. title: { type: String }, // 标题
  11. apply_year: { type: String }, // 申请年度
  12. project_info: { type: Object }, // 项目信息
  13. apply_index: { type: Array }, // 绩效指标
  14. status: { type: String, default: '0' }, // 0:草稿,1:待审中,2:审核通过,3:审核拒绝
  15. record: { type: Array }, // 记录
  16. remark: { type: String },
  17. };
  18. const schema = new Schema(duplicate, { toJSON: { virtuals: true } });
  19. schema.index({ id: 1 });
  20. schema.index({ 'meta.createdAt': 1 });
  21. schema.plugin(metaPlugin);
  22. module.exports = app => {
  23. const { mongoose } = app;
  24. return mongoose.model('Duplicate', schema, 'duplicate');
  25. };