36 lines
629 B
JavaScript
36 lines
629 B
JavaScript
|
'use strict';
|
||
|
|
||
|
const mongoose = require('mongoose');
|
||
|
const Schema = mongoose.Schema;
|
||
|
|
||
|
const LogFlagSchema = new Schema({
|
||
|
war: {
|
||
|
type: mongoose.Schema.Types.ObjectId,
|
||
|
ref: 'War',
|
||
|
required: true,
|
||
|
},
|
||
|
time: {
|
||
|
type: Date,
|
||
|
required: true,
|
||
|
},
|
||
|
player: {
|
||
|
type: String,
|
||
|
required: true,
|
||
|
},
|
||
|
flagFraction: {
|
||
|
type: String,
|
||
|
enum: ['BLUFOR', 'OPFOR'],
|
||
|
required: true,
|
||
|
},
|
||
|
capture: {
|
||
|
type: Boolean,
|
||
|
required: true,
|
||
|
},
|
||
|
}, {
|
||
|
collection: 'logFlag',
|
||
|
});
|
||
|
// optional more indices
|
||
|
LogFlagSchema.index({war: 1, player: 1});
|
||
|
|
||
|
module.exports = mongoose.model('LogFlag', LogFlagSchema);
|