2018-03-12 09:26:44 +01:00
|
|
|
'use strict';
|
2017-07-08 15:34:36 +02:00
|
|
|
|
|
|
|
const mongoose = require('mongoose');
|
|
|
|
const Schema = mongoose.Schema;
|
|
|
|
|
|
|
|
const PlayerSchema = new Schema({
|
|
|
|
name: {
|
|
|
|
type: String,
|
2018-03-12 09:26:44 +01:00
|
|
|
required: true,
|
2017-07-08 15:34:36 +02:00
|
|
|
},
|
|
|
|
fraction: {
|
|
|
|
type: String,
|
|
|
|
enum: ['BLUFOR', 'OPFOR'],
|
2018-03-12 09:26:44 +01:00
|
|
|
required: true,
|
2017-07-08 15:34:36 +02:00
|
|
|
},
|
|
|
|
warId: {
|
|
|
|
type: mongoose.Schema.Types.ObjectId,
|
|
|
|
ref: 'War',
|
2018-03-12 09:26:44 +01:00
|
|
|
required: true,
|
2017-07-08 15:34:36 +02:00
|
|
|
},
|
|
|
|
kill: {
|
|
|
|
type: Number,
|
2018-03-12 09:26:44 +01:00
|
|
|
get: (v) => Math.round(v),
|
|
|
|
set: (v) => Math.round(v),
|
|
|
|
required: true,
|
2018-03-03 12:26:24 +01:00
|
|
|
},
|
2018-04-14 13:44:50 +02:00
|
|
|
vehicleLight: {
|
|
|
|
type: Number,
|
|
|
|
get: (v) => Math.round(v),
|
|
|
|
set: (v) => Math.round(v),
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
vehicleHeavy: {
|
|
|
|
type: Number,
|
|
|
|
get: (v) => Math.round(v),
|
|
|
|
set: (v) => Math.round(v),
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
vehicleAir: {
|
2018-03-03 12:26:24 +01:00
|
|
|
type: Number,
|
2018-03-12 09:26:44 +01:00
|
|
|
get: (v) => Math.round(v),
|
|
|
|
set: (v) => Math.round(v),
|
|
|
|
required: true,
|
2017-07-08 15:34:36 +02:00
|
|
|
},
|
|
|
|
death: {
|
|
|
|
type: Number,
|
2018-03-12 09:26:44 +01:00
|
|
|
get: (v) => Math.round(v),
|
|
|
|
set: (v) => Math.round(v),
|
|
|
|
required: true,
|
2017-07-08 15:34:36 +02:00
|
|
|
},
|
|
|
|
friendlyFire: {
|
|
|
|
type: Number,
|
2018-03-12 09:26:44 +01:00
|
|
|
get: (v) => Math.round(v),
|
|
|
|
set: (v) => Math.round(v),
|
|
|
|
required: true,
|
2017-07-08 15:34:36 +02:00
|
|
|
},
|
2017-08-05 23:19:23 +02:00
|
|
|
revive: {
|
|
|
|
type: Number,
|
2018-03-12 09:26:44 +01:00
|
|
|
get: (v) => Math.round(v),
|
|
|
|
set: (v) => Math.round(v),
|
|
|
|
required: true,
|
2017-08-05 23:19:23 +02:00
|
|
|
},
|
2017-07-08 15:34:36 +02:00
|
|
|
respawn: {
|
|
|
|
type: Number,
|
2018-03-12 09:26:44 +01:00
|
|
|
get: (v) => Math.round(v),
|
|
|
|
set: (v) => Math.round(v),
|
|
|
|
required: true,
|
2017-07-08 15:34:36 +02:00
|
|
|
},
|
|
|
|
flagTouch: {
|
|
|
|
type: Number,
|
2018-03-12 09:26:44 +01:00
|
|
|
get: (v) => Math.round(v),
|
|
|
|
set: (v) => Math.round(v),
|
|
|
|
required: true,
|
2017-10-22 14:13:58 +02:00
|
|
|
},
|
|
|
|
sort: {
|
|
|
|
type: Number,
|
2018-03-12 09:26:44 +01:00
|
|
|
get: (v) => Math.round(v),
|
|
|
|
set: (v) => Math.round(v),
|
2018-02-26 09:33:28 +01:00
|
|
|
},
|
|
|
|
steamUUID: {
|
|
|
|
type: Number,
|
2018-03-12 09:26:44 +01:00
|
|
|
get: (v) => Math.round(v),
|
|
|
|
set: (v) => Math.round(v),
|
|
|
|
},
|
2019-02-09 20:42:24 +01:00
|
|
|
performance: {
|
|
|
|
type: mongoose.Schema.Types.ObjectId,
|
|
|
|
ref: 'LogServerFpsSchema',
|
2019-02-10 00:54:25 +01:00
|
|
|
required: false,
|
2019-02-09 20:42:24 +01:00
|
|
|
},
|
2017-07-08 15:34:36 +02:00
|
|
|
}, {
|
|
|
|
collection: 'player',
|
2018-03-12 09:26:44 +01:00
|
|
|
timestamps: {createdAt: 'timestamp'},
|
2017-07-08 15:34:36 +02:00
|
|
|
});
|
|
|
|
// optional more indices
|
2018-02-26 09:33:28 +01:00
|
|
|
PlayerSchema.index({warId: 1});
|
2017-07-08 15:34:36 +02:00
|
|
|
|
|
|
|
module.exports = mongoose.model('Player', PlayerSchema);
|