opt-cc/api/models/rank.js

30 lines
550 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 RankSchema = new Schema({
name: {
type: String,
required: true
},
fraction: {
type: String,
enum: ['BLUFOR', 'OPFOR'],
required: true
},
level: {
type: Number,
get: v => Math.round(v),
set: v => Math.round(v),
required: true
}
}, {
collection: 'rank',
timestamps: {createdAt: 'timestamp'}
});
// optional more indices
RankSchema.index({timestamp: 1});
module.exports = mongoose.model('Rank', RankSchema);