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

50 lines
909 B
JavaScript

'use strict';
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const LogVehicleKillSchema = new Schema({
war: {
type: mongoose.Schema.Types.ObjectId,
ref: 'War',
required: true,
},
time: {
type: Date,
required: true,
},
shooter: {
type: String,
},
additionalShooter: {
type: [String],
},
target: {
type: String,
required: true,
},
fraction: {
type: String,
enum: ['BLUFOR', 'OPFOR', 'NONE'],
required: true,
},
vehicleClass: {
type: String,
enum: ['LIGHT', 'HEAVY', 'AIR', 'UNKNOWN'],
required: true,
},
magazine: {
type: String,
},
shooterVehicle: {
type: String,
},
}, {
collection: 'logVehicle',
versionKey: false,
});
// optional more indices
LogVehicleKillSchema.index({war: 1, shooter: 1, target: 1});
module.exports = mongoose.model('LogVehicle', LogVehicleKillSchema);