1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- '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 schedule = {
- match_id: { type: String }, // 比赛id
- match_name: { type: String }, // 比赛名称
- red_id: { type: String }, // 比赛红方id
- red_name: { type: String }, // 比赛红方名称
- red_logo: { type: Array }, // 比赛红方logo
- red_members: { type: Array }, // 比赛红方成员
- red_branch: { type: String }, // 比赛红方比分
- red_integral: { type: String }, // 比赛红方积分
- red_position: { type: String }, // 比赛流程图位置
- blue_id: { type: String }, // 比赛蓝方id
- blue_name: { type: String }, // 比赛蓝方名称
- blue_logo: { type: Array }, // 比赛蓝方logo
- blue_members: { type: Array }, // 比赛蓝方成员
- blue_branch: { type: String }, // 比赛蓝方比分
- blue_integral: { type: String }, // 比赛蓝方积分
- blue_position: { type: String }, // 比赛流程图位置
- match_time: { type: String }, // 比赛时间
- match_file: { type: Array }, // 比赛图片
- status: { type: String, default: "0" }, // 状态
- position: { type: String }, // 比赛场次轮数
- format: { type: Array }, // 赛制
- is_bye: { type: Boolean, default: false }, // 是否轮空, 轮空只有1个队伍
- remark: { type: String },
- };
- const schema = new Schema(schedule, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ match_id: 1 });
- schema.index({ red_id: 1 });
- schema.index({ blue_id: 1 });
- schema.index({ match_time: 1 });
- schema.index({ status: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Schedule', schema, 'schedule');
- };
|