opt-cc/api/models/awarding.js

35 lines
648 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 AwardingSchema = new Schema({
userId: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User'
},
decorationId: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Decoration'
},
reason: {
type: String,
required: true
},
confirmed: {
type: Boolean,
default: true
},
date: {
type: Date,
default: Date.now()
}
}, {
collection: 'awarding',
timestamps: {createdAt: 'timestamp'}
});
// optional more indices
AwardingSchema.index({timestamp: 1});
module.exports = mongoose.model('Awarding', AwardingSchema);