opt-cc/server/models/logs/kill.js

49 lines
829 B
JavaScript

'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: {
type: Date,
required: true,
},
shooter: {
type: String,
},
target: {
type: String,
required: true,
},
friendlyFire: {
type: Boolean,
required: true,
},
magazine: {
type: String,
},
shooterVehicle: {
type: String,
},
targetVehicle: {
type: String,
},
fraction: {
type: String,
enum: ['BLUFOR', 'OPFOR', 'NONE'],
required: true,
},
}, {
collection: 'logKill',
versionKey: false,
});
// optional more indices
LogKillSchema.index({war: 1, shooter: 1, target: 1});
module.exports = mongoose.model('LogKill', LogKillSchema);