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

50 lines
917 B
JavaScript
Raw 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,
2020-04-19 12:47:22 +02:00
enum: ['LIGHT', 'HEAVY', 'AIR', 'BOAT', '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);