From 8746fc92f0e401f472bb3f52720faa0c56e3fc9c Mon Sep 17 00:00:00 2001 From: arnaucode Date: Wed, 26 Jul 2017 15:07:30 +0200 Subject: [PATCH] implemented network map of users and travels, for admin --- controllers/adminController.js | 133 ++++++++++++++++++++++++++++++++- server.js | 3 + 2 files changed, 134 insertions(+), 2 deletions(-) diff --git a/controllers/adminController.js b/controllers/adminController.js index 5da09e5..f15a63c 100644 --- a/controllers/adminController.js +++ b/controllers/adminController.js @@ -1,6 +1,8 @@ //File: controllers/userController.js var mongoose = require('mongoose'); -var userModel = mongoose.model('adminModel'); +var adminModel = mongoose.model('adminModel'); +var userModel = mongoose.model('userModel'); +var travelModel = mongoose.model('travelModel'); var config = require('../config'); var pageSize = config.pageSize; @@ -53,7 +55,7 @@ exports.signup = function(req, res) { //POST - auth user exports.login = function(req, res) { // find the user - userModel.findOne({ + adminModel.findOne({ username: req.body.username }) .select('+password') @@ -117,3 +119,130 @@ exports.changePassword = function(req, res) { exports.getUserByToken(req, res); }); }; + +function isNodeInNodes(node, nodes){ + for (var i=0; i