Skip to content
Snippets Groups Projects
Commit 7f5eed2c authored by Martin Lehoux's avatar Martin Lehoux
Browse files

bugs and linting

parent 767a922b
No related branches found
No related tags found
No related merge requests found
const mongoose = require('mongoose');
const Notification = new mongoose.Schema({
title: {
type: String,
required: true,
},
content: {
type: String,
},
persistant: {
type: Boolean,
default: false,
},
color: {
type: String,
default: ""
}
title: { type: String, required: true },
content: { type: String },
persistant: { type: Boolean, default: false },
color: { type: String, default: "" }
});
module.exports = Notification;
\ No newline at end of file
......@@ -2,26 +2,11 @@ const mongoose = require('mongoose');
const Notification = require('./notification');
const User = new mongoose.Schema({
firstName: {
type: String,
required: true,
},
lastName: {
type: String,
required: true,
},
username: {
unique: true,
type: String,
lowercase: true,
},
email: {
type: String,
required: true,
},
passwordHash: {
type: String,
},
firstName: { type: String, required: true },
lastName: { type: String, required: true },
username: { unique: true, type: String, lowercase: true },
email: { type: String, required: true },
passwordHash: { type: String },
notifications: [Notification],
});
......
......@@ -5,7 +5,7 @@ const warn = (req, res, title, content) => {
const error = (req, res, title, content) => {
req.session.user.notifications.push({ title, content, color: "error" });
req.user.session.save();
req.session.user.save();
return res.redirect('/'); // TODO redirect to error route or previous
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment