12345678910111213141516171819202122232425 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
- const { ObjectId } = require('mongoose').Types;
- // 表
- const certfile = {
- apply_id: { type: String }, // 成果评价申请id
- apply_name: { type: String }, // 成果评价申请名称
- user_id: { type: String }, // 申请人id
- user_name: { type: String }, // 申请人姓名
- file: { type: Array }, // 证书资料
- remark: { type: String },
- };
- const schema = new Schema(certfile, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ apply_id: 1 });
- schema.index({ apply_name: 1 });
- schema.index({ user_name: 1 });
- schema.index({ user_id: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Certfile', schema, 'certfile');
- };
|