diff --git a/controllers/travelController.js b/controllers/travelController.js index d0bbc98..ec0c95f 100644 --- a/controllers/travelController.js +++ b/controllers/travelController.js @@ -53,7 +53,7 @@ exports.addTravel = function(req, res) { seats: req.body.seats, package: req.body.package, collectivized: req.body.collectivized, - type: req.body.modality + type: req.body.type }); travel.save(function(err, travel) { diff --git a/controllers/userController.js b/controllers/userController.js index 1aed7b2..560aa82 100644 --- a/controllers/userController.js +++ b/controllers/userController.js @@ -111,7 +111,7 @@ exports.getAllUsers = function(req, res) { exports.getUserById = function (req, res) { userModel.findOne({_id: req.params.userid}) .lean() - .populate('travels', 'title from to date') + .populate('travels', 'title from to date type') .exec(function (err, user) { if (err) return res.send(500, err.message); if (!user) { diff --git a/models/userModel.js b/models/userModel.js index 9a02e13..8f3cfab 100644 --- a/models/userModel.js +++ b/models/userModel.js @@ -9,7 +9,7 @@ var userSchema = new Schema({ password: { type: String, required: true, selected: false }, token: { type: String, selected: false }, description: { type: String, default: "Hello world" }, - avatar: { type: String, default: "racoon" }, + avatar: { type: String, default: "img/avatars/racoon.png" }, email: { type: String, required: true }, phone: { type: String }, telegram: { type: String }, diff --git a/server.js b/server.js index 0e622a1..30a2835 100755 --- a/server.js +++ b/server.js @@ -81,7 +81,8 @@ apiRoutes.use(function(req, res, next) { // verifies secret and checks exp jwt.verify(token, app.get('superSecret'), function(err, decoded) { if (err) { - return res.json({ + return res.send(204, + { success: false, message: 'Failed to authenticate token.' }); @@ -97,7 +98,7 @@ apiRoutes.use(function(req, res, next) { // if there is no token // return an error - return res.status(201).send({ + return res.status(204).send({ success: false, message: 'No token provided.' });