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

50 lines
909 B
JavaScript
Raw Permalink Normal View History

2018-03-12 09:26:44 +01:00
'use strict';
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const LogVehicleKillSchema = new Schema({
war: {
type: mongoose.Schema.Types.ObjectId,
ref: 'War',
2018-03-12 09:26:44 +01:00
required: true,
},
time: {
type: Date,
2018-03-12 09:26:44 +01:00
required: true,
},
shooter: {
2018-03-12 09:26:44 +01:00
type: String,
},
additionalShooter: {
type: [String],
},
target: {
type: String,
2018-03-12 09:26:44 +01:00
required: true,
},
fraction: {
type: String,
enum: ['BLUFOR', 'OPFOR', 'NONE'],
2018-03-12 09:26:44 +01:00
required: true,
},
vehicleClass: {
type: String,
2018-04-15 13:47:48 +02:00
enum: ['LIGHT', 'HEAVY', 'AIR', 'UNKNOWN'],
required: true,
},
magazine: {
type: String,
},
shooterVehicle: {
type: String,
},
}, {
2018-03-12 09:26:44 +01:00
collection: 'logVehicle',
versionKey: false,
});
// optional more indices
LogVehicleKillSchema.index({war: 1, shooter: 1, target: 1});
module.exports = mongoose.model('LogVehicle', LogVehicleKillSchema);