achieve_cert.js 1.0 KB

1234567891011121314151617181920212223242526
  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. const { Secret } = require('naf-framework-mongoose/lib/model/schema');
  7. // 证书资料
  8. const achieve_cert = {
  9. apply_id: { type: String }, // 成果评价申请id
  10. apply_name: { type: String }, // 成果评价申请名称
  11. user_id: { type: String }, // 申请人id
  12. user_name: { type: String }, // 申请人姓名
  13. file: { type: Object }, // 证书资料
  14. remark: { type: String, maxLength: 200 },
  15. create_time: { type: String, default: moment().format("YYYY-MM-DD HH:mm:ss"), },
  16. };
  17. const schema = new Schema(achieve_cert, { toJSON: { virtuals: true } });
  18. schema.index({ id: 1 });
  19. schema.index({ apply_id: 1 });
  20. schema.index({ user_id: 1 });
  21. schema.index({ 'meta.createdAt': 1 });
  22. schema.plugin(metaPlugin);
  23. module.exports = app => {
  24. const { mongoose } = app;
  25. return mongoose.model('Achieve_cert', schema, 'achieve_cert');
  26. };