diff --git a/README.md b/README.md index 9f43559..2b111cd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ #CollectiveCar app +frontend app code: https://github.com/idoctnef/collectivecarApp **Backend:** Nodejs + Express + MongoDB diff --git a/controllers/travelController.js b/controllers/travelController.js index 1baaebb..7b232ca 100644 --- a/controllers/travelController.js +++ b/controllers/travelController.js @@ -92,11 +92,11 @@ exports.updateTravel = function(req, res) { //DELETE exports.deleteTravel = function(req, res) { - ActivityModel.findById(req.params.id, function(err, activity) { - activity.remove(function(err) { + travelModel.findById(req.params.id, function(err, travel) { + travel.remove(function(err) { if(err) return res.send(500, err.message); res.status(200).jsonp(req.params.id); - console.log('DELETE /activities/' + req.params.id); + console.log('DELETE /traves/' + req.params.id); }) }); }; diff --git a/controllers/userController.js b/controllers/userController.js index 9846848..54fac03 100644 --- a/controllers/userController.js +++ b/controllers/userController.js @@ -136,7 +136,7 @@ exports.login = function(req, res) { // create a token var token = jwt.sign(user, app.get('superSecret'), { //expiresInMinutes: 1440 // expires in 24 hours - expiresIn: '60m' + //expiresIn: '60m' }); console.log(user); // return the information including token as JSON diff --git a/models/travelModel.js b/models/travelModel.js index 2a99030..c163199 100644 --- a/models/travelModel.js +++ b/models/travelModel.js @@ -17,7 +17,9 @@ var travelSchema = new Schema({ phone: { type: Number }, telegram: { type: String }, collectivized: { type: Boolean }, - modality: { type: String } //if is an offering travel or asking for travel + modality: { type: String }, //if is an offering travel or asking for travel + joinedusers: { type: String }, + acceptedusers: { type: String } }) module.exports = mongoose.model('travelModel', travelSchema); diff --git a/server.js b/server.js index 62099d6..fd1fba5 100755 --- a/server.js +++ b/server.js @@ -69,7 +69,7 @@ apiRoutes.route('/travels') .get(travelCtrl.findAllTravels); apiRoutes.route('/travels/:id') -.get(travelCtrl.findById) + .get(travelCtrl.findById); // OJU AQUƏ TREC la verificaciĆ³ de token temporalment, per fer les proves des de l'app // route middleware to verify a token @@ -80,7 +80,6 @@ apiRoutes.use(function(req, res, next) { // decode token if (token) { - // verifies secret and checks exp jwt.verify(token, app.get('superSecret'), function(err, decoded) { if (err) {