'use strict'; const Schema = require('mongoose').Schema; const moment = require('moment'); const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin'); const { ObjectId } = require('mongoose').Types; // 加入团队 const joinapply = { team_id: { type: String }, // 团队id team_name: { type: String }, // 团队名称 apply_time: { type: String }, // 申请时间 apply_user: { type: String }, // 申请人 apply_id: { type: String }, // 申请人id status: { type: String, default: '0' }, // 状态 remark: { type: String }, }; const schema = new Schema(joinapply, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ team_id: 1 }); schema.index({ apply_time: 1 }); schema.index({ apply_id: 1 }); schema.index({ status: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Joinapply', schema, 'joinapply'); };