opt-cc/opt-cc-api/models/squad.js

31 lines
572 B
JavaScript
Raw Normal View History

2017-05-10 11:04:06 +02:00
"use strict";
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const SquadSchema = new Schema({
name: {
type: String,
required: true
},
fraction: {
type: String,
enum: ['BLUFOR', 'OPFOR'],
required: true
},
sortingNumber: {
type: Number,
max: 22,
get: v => Math.round(v),
set: v => Math.round(v),
default: 0
}
}, {
collection: 'squad',
timestamps: {createdAt: 'timestamp'}
});
// optional more indices
SquadSchema.index({timestamp: 1});
module.exports = mongoose.model('Squad', SquadSchema);