Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
tCook017 committed Apr 6, 2018
2 parents 607f5fd + 1861df0 commit b61dd93
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 9 deletions.
10 changes: 4 additions & 6 deletions routes/update/ban.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ const Ban = require(_base + 'models/ban');
module.exports = {
'/update/ban': {
methods: ['put'],
middleware: [],
middleware: [ensureAuthenticity],
fn: function(req, res, next) {

let updateFields = {};
ip = req.body.ip;
const ip = req.body.ip;

if(req.body.time !== undefined) {
if(req.body.time) {
updateFields.time = req.body.time;
}

if(req.body.message !== undefined) {
if(req.body.message) {
updateFields.message = req.body.message;
}

Expand All @@ -22,9 +22,7 @@ module.exports = {
return next(err);
}

if(result) {
res.json({ result: result });
}
});
}
}
Expand Down
4 changes: 3 additions & 1 deletion routes/update/board.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ const Board = require(_base + 'models/board.js');
module.export = {
'/update/board': {
methods: ['put'],
middleware: [ensureAuthenticity],
fn: function(req, res, next) {
const letter = req.body.letter;

let updateFields = {};
const letter = req.body.letter;

if(req.body.category) {
updateFields.category = req.body.category;
Expand Down
17 changes: 15 additions & 2 deletions routes/update/mod.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,27 @@ const Mod = require(_base + 'models/mod.js');
module.export = {
'/update/mod': {
methods: ['put'],
middleware: [''],
middleware: [ensureAuthenticity],
fn: function(req, res, next) {
const _id = req.body._id;

let updateFields = {};
const _id = req.body._id;

if(req.body.email) {
updateFields.email = req.body.email;
}

if(req.body.password) {
updateFields.password = req.body.password;
}

Mod.findOneAndUpdate({ _id: _id }, updateFields, function(err, result) {
if(err) {
return next(err);
}

res.json({ result: result });
}
}
}

Expand Down
31 changes: 31 additions & 0 deletions routes/update/reply.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const Reply = require(_base + 'models/reply.js');

module.exports = {
'/update/reply': {
methods: ['put'],
fn: function(req, res, next) {
//TODO: add update for attachments
let updateFields = {};
const id = req.body._id;


if(req.body.content) {
updateFields.content = req.body.content;
}

//if(req.body.attachment) {
// updateFields.attachment = req.body.attachment;
//}

Reply.findOneAndUpdate({ _id: id }, updateFields, function(err, result) {
if(err) {
return next(err);
}

res.json({ result: result });

});
}
}
}

Empty file modified src/assets/logo.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b61dd93

Please sign in to comment.