diff --git a/app.js b/app.js index e45521e..e69bc5a 100644 --- a/app.js +++ b/app.js @@ -1,3 +1,5 @@ +// General comments that apply to the whole tree of docs pertains to logging. Remove all +// log statements in both server and frontend var express = require('express'); var path = require('path'); var favicon = require('serve-favicon'); @@ -80,6 +82,7 @@ app.use(function(req, res) { var mongoURI = process.env.MONGO_URI; mongoose.connect(mongoURI); +// What happens for local deployment? Do you handle that -- getting a mongo connect error on local testing var db = mongoose.connection; db.on('error', console.error.bind(console, 'connection error:')); db.once('open', function() { diff --git a/public/javascripts/d3Controller.js b/public/javascripts/d3Controller.js index 29e9e2a..87b1d7b 100644 --- a/public/javascripts/d3Controller.js +++ b/public/javascripts/d3Controller.js @@ -1,3 +1,5 @@ +// Very nice work on the d3 vizualizations + //Controller to show and create vizs based on data on a specific student var d3Controller = function($scope, $http, $state) { diff --git a/public/javascripts/ngApp.js b/public/javascripts/ngApp.js index df86c53..547782b 100644 --- a/public/javascripts/ngApp.js +++ b/public/javascripts/ngApp.js @@ -7,7 +7,7 @@ springInitiative.config(function($stateProvider, $urlRouterProvider, $locationProvider) { $urlRouterProvider.otherwise('/'); - + // I love state provider $stateProvider /* Page views */ @@ -124,6 +124,7 @@ springInitiative.config(function($stateProvider, $urlRouterProvider, }); +// Include commenting please here springInitiative.run(function($rootScope, $state, $http) { $rootScope.$on('$stateChangeStart', function(event, next, current) { $http.get('/user').then(function(data) { diff --git a/public/javascripts/studentControllers.js b/public/javascripts/studentControllers.js index a11cdea..1cbc780 100644 --- a/public/javascripts/studentControllers.js +++ b/public/javascripts/studentControllers.js @@ -1,3 +1,5 @@ +// Nothing is commeneted... + //controller to deal with current student functions such as deleting, adding entries, etc. var studentController = function($scope, $http, $state) { diff --git a/public/views/login.html b/public/views/login.html index db42bf4..2338b6d 100644 --- a/public/views/login.html +++ b/public/views/login.html @@ -11,6 +11,7 @@

Please sign in

{{password_error}}
+ × A verification email for {{email}} is now pending admin(s) and your approval.
diff --git a/routes/entryRoutes.js b/routes/entryRoutes.js index e8cd47f..1801308 100644 --- a/routes/entryRoutes.js +++ b/routes/entryRoutes.js @@ -116,7 +116,8 @@ routes.GETcohortEntries = function(req, res) { var engageContentList = []; var engagePeerList = []; var engageAdultList = []; - + + // What's the purpose of archived here? Student.find({program:cohort, archived: false}, function(err, students){ var studentIds = students.map(function(student){return student._id;}); FormDB.find({_studentID:{$in:studentIds}}, function(err, forms) { diff --git a/routes/index.js b/routes/index.js index cf0808b..2b1e0bc 100644 --- a/routes/index.js +++ b/routes/index.js @@ -3,6 +3,9 @@ var path = require('path'); var routes = {}; +// As a general note: each method in your API routes files should have documentation as to what it does +// and are the relevant requests and responces. + var userRoutes = require(path.join(__dirname, './userRoutes')); var studentRoutes = require(path.join(__dirname, './studentRoutes')); var entryRoutes = require(path.join(__dirname, './entryRoutes')); diff --git a/routes/userRoutes.js b/routes/userRoutes.js index 9bd0cfe..ba86c6e 100644 --- a/routes/userRoutes.js +++ b/routes/userRoutes.js @@ -10,6 +10,7 @@ var sendgrid = require('sendgrid')(process.env.SENDGRID_USERNAME, var User = require(path.join(__dirname, '../models/user')); +// Is the password being encrypted appropriately here? bcrypt-nodejs and scrypf (verifyKdfSync etc.) not a bad library to accompish this routes.POSTlogin = function(req, res, next) { passport.authenticate('local', function(err, user, info) { if (err) @@ -39,6 +40,7 @@ routes.POSTregister = function(req, res, next) { if (err) return res.status(403).send(err.message); // Get admin emails + // I really like the use of smart mongoose syntax in filtering User.find({isAdmin: true}, {email: 1, _id: 0}, function(err, admins) { // send email verification to admins var half = user.authToken.length / 2; @@ -53,6 +55,7 @@ routes.POSTregister = function(req, res, next) { email.addTo(admins[i].email); } + // That was sweet. Sendgrid looks super interesting and easy touse email.setFrom('SpringInitiative@olinjs.com'); email.setSubject(user.email + ' wants to register for Spring Initiative\'s website.'); email.setHtml('