Skip to content

Commit

Permalink
Fixed board creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ryankeegan committed Apr 9, 2018
1 parent 8ed084e commit faab999
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion models/board.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ let mongoose = require("mongoose");

let boardSchema = new mongoose.Schema({

categoryName: { type: String, required: true },
categoryName: { type: String, default: "Interests" },
name: { type: String, required: true, unique: true },
letter: { type: String, required: true, unique: true },
favIcon: { type: String }
Expand Down
3 changes: 3 additions & 0 deletions nohup.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MongoDB shell version: 3.0.14
connecting to: test
bye
10 changes: 5 additions & 5 deletions routes/create/board.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
const Board = require(_base + 'models/board');
const Board = require(_base + 'models/board'),
ensureAuthenticity = require(_base + 'middleware/ensureAuthenticity');

//will need mod authentication
module.exports = {
'/create/board': {
methods: ['post'],
methods: ['post'],
middleware: [ensureAuthenticity],
fn: function(req, res, next) {
let category = req.body.category,
name = req.body.name,
Expand All @@ -26,9 +28,7 @@ module.exports = {
if(err) {
return next(err);
}
res.json({ result: { letter: letter,
category: category,
name: name }});
res.redirect('/' + letter + '/catalog');
});

});
Expand Down

0 comments on commit faab999

Please sign in to comment.