2017-07-08 15:34:36 +02:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const mongoose = require('mongoose');
|
|
|
|
const Schema = mongoose.Schema;
|
|
|
|
|
|
|
|
const WarSchema = new Schema({
|
2017-07-08 22:50:01 +02:00
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
2017-07-08 15:34:36 +02:00
|
|
|
date: {
|
|
|
|
type: Date,
|
|
|
|
},
|
|
|
|
ptBlufor: {
|
|
|
|
type: Number,
|
|
|
|
get: v => Math.round(v),
|
|
|
|
set: v => Math.round(v),
|
|
|
|
},
|
|
|
|
ptOpfor: {
|
|
|
|
type: Number,
|
|
|
|
get: v => Math.round(v),
|
|
|
|
set: v => Math.round(v),
|
|
|
|
},
|
2017-07-30 08:55:14 +02:00
|
|
|
playersBlufor: {
|
|
|
|
type: Number,
|
|
|
|
get: v => Math.round(v),
|
|
|
|
set: v => Math.round(v),
|
2017-07-30 10:57:04 +02:00
|
|
|
default: 0
|
2017-07-30 08:55:14 +02:00
|
|
|
},
|
|
|
|
playersOpfor: {
|
|
|
|
type: Number,
|
|
|
|
get: v => Math.round(v),
|
|
|
|
set: v => Math.round(v),
|
2017-07-30 10:57:04 +02:00
|
|
|
default: 0
|
2017-08-12 16:28:18 +02:00
|
|
|
},
|
|
|
|
campaign: {
|
|
|
|
type: mongoose.Schema.Types.ObjectId,
|
2017-10-21 12:11:32 +02:00
|
|
|
ref: 'Campaign',
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
budgetBlufor: {
|
|
|
|
type: Number,
|
|
|
|
get: v => Math.round(v),
|
|
|
|
set: v => Math.round(v),
|
|
|
|
default: 0
|
|
|
|
},
|
|
|
|
budgetOpfor: {
|
|
|
|
type: Number,
|
|
|
|
get: v => Math.round(v),
|
|
|
|
set: v => Math.round(v),
|
|
|
|
default: 0
|
|
|
|
},
|
|
|
|
endBudgetBlufor: {
|
|
|
|
type: Number,
|
|
|
|
get: v => Math.round(v),
|
|
|
|
set: v => Math.round(v),
|
|
|
|
default: 0
|
|
|
|
},
|
|
|
|
endBudgetOpfor: {
|
|
|
|
type: Number,
|
|
|
|
get: v => Math.round(v),
|
|
|
|
set: v => Math.round(v),
|
|
|
|
default: 0
|
|
|
|
},
|
2017-07-08 15:34:36 +02:00
|
|
|
}, {
|
|
|
|
collection: 'war',
|
|
|
|
timestamps: {createdAt: 'timestamp'}
|
|
|
|
});
|
|
|
|
// optional more indices
|
|
|
|
WarSchema.index({timestamp: 1});
|
|
|
|
|
|
|
|
module.exports = mongoose.model('War', WarSchema);
|