1234567891011121314151617181920212223242526 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const moment = require('moment');
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- const { ObjectId } = require('mongoose').Types;
- const { Secret } = require('naf-framework-mongoose/lib/model/schema');
- // 证书资料
- const achieve_cert = {
- apply_id: { type: String }, // 成果评价申请id
- apply_name: { type: String }, // 成果评价申请名称
- user_id: { type: String }, // 申请人id
- user_name: { type: String }, // 申请人姓名
- file: { type: Object }, // 证书资料
- remark: { type: String, maxLength: 200 },
- create_time: { type: String, default: moment().format("YYYY-MM-DD HH:mm:ss"), },
- };
- const schema = new Schema(achieve_cert, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ apply_id: 1 });
- schema.index({ user_id: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Achieve_cert', schema, 'achieve_cert');
- };
|