123456789101112131415161718192021222324252627 |
- '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 match = {
- name: { type: String }, // 比赛名称
- match_time: { type: String }, // 时间
- single_time: { type: String }, // 单场时间
- address: { type: String }, // 地点
- format: { type: Array }, // 赛制
- match_team: { type: Array }, // 比赛队伍
- status: { type: String, default: '0' }, // 状态
- remark: { type: String },
- };
- const schema = new Schema(match, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ single_time: 1 });
- schema.index({ status: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Match', schema, 'match');
- };
|