Skip to content

Commit

Permalink
Updated saveUser method. Removed unnecessary comments. Added a callba…
Browse files Browse the repository at this point in the history
…ck into updateUser parameter
  • Loading branch information
JeanKoh committed Mar 5, 2017
1 parent 67a4abb commit b34c8b2
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions app/database/objectClasses/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class User {
skills : skill_sets,
bookmarked_users : bookedmarked_users,
});
console.log("constructor");
this.ModelHandler.disconnect();
}

Expand Down Expand Up @@ -76,18 +75,18 @@ class User {
*/
saveUser(callback){
User.connectDB();
this.userModelDoc.save(callback)
console.log("save user");
this.userModelDoc.save(function(err){
callback(err);
});
User.disconnectDB();
}

/**
* Remove the collection of Users from database
*/
static clearAllUser(){
static clearAllUser(callback){
User.connectDB();
this.userModel.collection.remove({});
console.log("clearing users");
this.userModel.remove({}, callback);
User.disconnectDB();
}

Expand All @@ -111,7 +110,6 @@ class User {
cb(null,userDoc);
}
});
console.log("all users");
User.disconnectDB();
}

Expand Down Expand Up @@ -153,8 +151,9 @@ class User {
* @param {String} profile_pic: A url string which contains the profile picture.
* @param {StringArray} skills_set: The skills that the user possess. Such as programming skills, management skills, etc
* @param {StringArray} bookedmarked_users: A collection of users' emails that the current user wants to keep track of.
* @param {callback} for error checking
*/
static updateUser(email = "", name = "", description = "", password = "", will_notify = true, is_deleted = false, profile_pic = "", skill_sets = [], bookedmarked_users = []){
static updateUser(email = "", name = "", description = "", password = "", will_notify = true, is_deleted = false, profile_pic = "", skill_sets = [], bookedmarked_users = [], callback){

//The list of attributes that will be updated
var update = { email : email,
Expand Down

0 comments on commit b34c8b2

Please sign in to comment.