opt-cc/api/models/logs/transport.js

42 lines
758 B
JavaScript
Raw Normal View History

2017-10-21 18:23:04 +02:00
"use strict";
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const LogTransportSchema = new Schema({
war: {
type: mongoose.Schema.Types.ObjectId,
ref: 'War',
required: true
},
time: {
2017-10-29 17:36:55 +01:00
type: Date,
2017-10-21 18:23:04 +02:00
required: true
},
driver: {
type: String,
required: true
},
passenger: {
type: String,
required: true
},
distance: {
type: Number,
get: v => Math.round(v),
set: v => Math.round(v),
required: true
},
fraction: {
type: String,
enum: ['BLUFOR', 'OPFOR'],
required: true
2017-10-21 18:23:04 +02:00
}
}, {
collection: 'logTransport'
});
// optional more indices
2018-02-26 09:33:28 +01:00
LogTransportSchema.index({war: 1, driver: 1});
2017-10-21 18:23:04 +02:00
module.exports = mongoose.model('LogTransport', LogTransportSchema);