diff options
| author | HumairAK <humair88@hotmail.com> | 2016-07-23 04:12:11 +0000 |
|---|---|---|
| committer | HumairAK <humair88@hotmail.com> | 2016-07-23 04:12:11 +0000 |
| commit | 0ccf1dc1b80fe2dff8f98538ffac673c6b326a57 (patch) | |
| tree | 82a55e2b940dbe56b2f1308fbee86a07abe82294 /node_simple.js | |
| parent | 297b50e415b9db833128fa9b9574a35b7ca453d6 (diff) | |
Added admin cpanel functionality, added serverCallback in parameters for some database queries.
Diffstat (limited to 'node_simple.js')
| -rw-r--r-- | node_simple.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/node_simple.js b/node_simple.js index cd6d06f..cf06e61 100644 --- a/node_simple.js +++ b/node_simple.js @@ -112,11 +112,11 @@ exports.add_user = function (fields, callbackUser) { }; // find out if this user already exists by checking their email - exports.find_user( fields[0], function (result) { + exports.find_user( fields[0] ,callbackUser, function (result, callbackUser) { if (result == false) { // find out if the user_name is taken - exports.find_user_name( fields[1], function (docs) { + exports.find_user_name( fields[1], callbackUser, function (docs) { if (docs == false) { // if not ... // continue console.log("user name is valid"); @@ -682,7 +682,7 @@ exports.find_course = function (course_code, callback) { * Params: fields - an array of format ["course_code", year, "term", "type"] * * */ -exports.remove_exam = function (fields) { +exports.remove_exam = function (fields, serverCallback) { var course_code = fields[0]; var year = fields[1]; @@ -707,10 +707,14 @@ exports.remove_exam = function (fields) { if (err) throw err; else { if (docs.deletedCount == 1) { - console.log("exam was removed"); + serverCallback(true, "Exam was removed successfully"); + db.close(); + //console.log("exam was removed"); } else if (docs.deletedCount == 0) { - console.log("No such exam was found"); + serverCallback(false, "No such exam was found"); + db.close(); + //console.log("No such exam was found"); } } } |
