certfile.js 892 B

12345678910111213141516171819202122232425
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
  4. const { ObjectId } = require('mongoose').Types;
  5. // 表
  6. const certfile = {
  7. apply_id: { type: String }, // 成果评价申请id
  8. apply_name: { type: String }, // 成果评价申请名称
  9. user_id: { type: String }, // 申请人id
  10. user_name: { type: String }, // 申请人姓名
  11. file: { type: Array }, // 证书资料
  12. remark: { type: String },
  13. };
  14. const schema = new Schema(certfile, { toJSON: { virtuals: true } });
  15. schema.index({ id: 1 });
  16. schema.index({ apply_id: 1 });
  17. schema.index({ apply_name: 1 });
  18. schema.index({ user_name: 1 });
  19. schema.index({ user_id: 1 });
  20. schema.index({ 'meta.createdAt': 1 });
  21. schema.plugin(metaPlugin);
  22. module.exports = app => {
  23. const { mongoose } = app;
  24. return mongoose.model('Certfile', schema, 'certfile');
  25. };