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

35 lines
697 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 DecorationSchema = new Schema({
name: {
type: String,
required: true
},
fraction: {
type: String,
enum: ['BLUFOR', 'OPFOR', 'GLOBAL'],
required: true
},
description: {
type: String,
required: true
},
sortingNumber: {
type: Number,
get: v => Math.round(v),
set: v => Math.round(v),
default: 0
},
isMedal: {type: Boolean, required: true}
}, {
collection: 'decoration',
timestamps: {createdAt: 'timestamp'}
});
// optional more indices
DecorationSchema.index({timestamp: 1});
module.exports = mongoose.model('Decoration', DecorationSchema);