Skip to content

Instantly share code, notes, and snippets.

@TheRobOne
Created September 5, 2019 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheRobOne/6e2647aab9ae50226657fd411a61a741 to your computer and use it in GitHub Desktop.
Save TheRobOne/6e2647aab9ae50226657fd411a61a741 to your computer and use it in GitHub Desktop.
const mongoose = require('mongoose');
const fauilureSchema = new mongoose.Schema({
roomNumber: {
type: String,
required: true
},
building: {
type: String,
required: true
},
title: {
type: String,
required: true
},
description: {
type: String,
required: true
},
authorEmail: {
type: String,
required: true
},
state: {
type: String,
default: 'Nowa'
},
date: {
type: String,
required: true
},
dateReal: {
type: Date,
default: Date.now
}
});
let Failure = module.exports = mongoose.model('Failure', fauilureSchema);
//add new Failure
module.exports.addFailure = (failure, callback) => {
Failure.create(failure, callback);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment