Created
September 5, 2019 21:20
-
-
Save TheRobOne/6e2647aab9ae50226657fd411a61a741 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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