joinapply.js 966 B

12345678910111213141516171819202122232425262728
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. // 加入团队
  7. const joinapply = {
  8. team_id: { type: String }, // 团队id
  9. team_name: { type: String }, // 团队名称
  10. apply_time: { type: String }, // 申请时间
  11. apply_user: { type: String }, // 申请人
  12. apply_id: { type: String }, // 申请人id
  13. status: { type: String, default: '0' }, // 状态
  14. remark: { type: String },
  15. };
  16. const schema = new Schema(joinapply, { toJSON: { virtuals: true } });
  17. schema.index({ id: 1 });
  18. schema.index({ team_id: 1 });
  19. schema.index({ apply_time: 1 });
  20. schema.index({ apply_id: 1 });
  21. schema.index({ status: 1 });
  22. schema.index({ 'meta.createdAt': 1 });
  23. schema.plugin(metaPlugin);
  24. module.exports = app => {
  25. const { mongoose } = app;
  26. return mongoose.model('Joinapply', schema, 'joinapply');
  27. };