2017-10-21 18:23:04 +02:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const mongoose = require('mongoose');
|
|
|
|
const Schema = mongoose.Schema;
|
|
|
|
|
|
|
|
const LogKillSchema = new Schema({
|
|
|
|
war: {
|
|
|
|
type: mongoose.Schema.Types.ObjectId,
|
|
|
|
ref: 'War',
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
time: {
|
2017-10-24 20:21:06 +02:00
|
|
|
type: Number,
|
2017-10-21 18:23:04 +02:00
|
|
|
required: true
|
|
|
|
},
|
|
|
|
ptBlufor: {
|
|
|
|
type: Number,
|
|
|
|
get: v => Math.round(v),
|
|
|
|
set: v => Math.round(v),
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
ptOpfor: {
|
|
|
|
type: Number,
|
|
|
|
get: v => Math.round(v),
|
|
|
|
set: v => Math.round(v),
|
|
|
|
required: true
|
2017-10-21 19:49:24 +02:00
|
|
|
},
|
|
|
|
fraction: {
|
|
|
|
type: String,
|
|
|
|
enum: ['BLUFOR', 'OPFOR', 'NONE'],
|
|
|
|
required: true
|
2017-10-21 18:23:04 +02:00
|
|
|
}
|
|
|
|
}, {
|
2017-10-21 19:49:24 +02:00
|
|
|
collection: 'logPoints'
|
2017-10-21 18:23:04 +02:00
|
|
|
});
|
|
|
|
// optional more indices
|
|
|
|
LogKillSchema.index({war: 1, shooter: 1, target: 1});
|
|
|
|
|
2017-10-21 19:49:24 +02:00
|
|
|
module.exports = mongoose.model('LogPoints', LogKillSchema);
|