db/GroupManager: use jshint

This commit is contained in:
booo 2011-12-22 11:57:23 +01:00
parent a505503e2f
commit a07563b922

View file

@ -39,7 +39,7 @@ exports.deleteGroup = function(groupID, callback)
if(ERR(err, callback)) return; if(ERR(err, callback)) return;
//group does not exist //group does not exist
if(_group == null) if(!_group)
{ {
callback(new customError("groupID does not exist","apierror")); callback(new customError("groupID does not exist","apierror"));
} }
@ -81,7 +81,10 @@ exports.deleteGroup = function(groupID, callback)
if(ERR(err, callback)) return; if(ERR(err, callback)) return;
//skip if there is no group2sessions entry //skip if there is no group2sessions entry
if(group2sessions == null) {callback(); return} if(!group2sessions) {
callback();
return;
}
//collect all sessions in an array, that allows us to use async.forEach //collect all sessions in an array, that allows us to use async.forEach
var sessions = []; var sessions = [];
@ -109,7 +112,7 @@ exports.deleteGroup = function(groupID, callback)
if(ERR(err, callback)) return; if(ERR(err, callback)) return;
callback(); callback();
}); });
} };
exports.doesGroupExist = function(groupID, callback) exports.doesGroupExist = function(groupID, callback)
{ {
@ -117,9 +120,9 @@ exports.doesGroupExist = function(groupID, callback)
db.get("group:" + groupID, function (err, group) db.get("group:" + groupID, function (err, group)
{ {
if(ERR(err, callback)) return; if(ERR(err, callback)) return;
callback(null, group != null); callback(null, group ? true : false);
}); });
} };
exports.createGroup = function(callback) exports.createGroup = function(callback)
{ {
@ -129,7 +132,7 @@ exports.createGroup = function(callback)
//create the group //create the group
db.set("group:" + groupID, {pads: {}}); db.set("group:" + groupID, {pads: {}});
callback(null, {groupID: groupID}); callback(null, {groupID: groupID});
} };
exports.createGroupIfNotExistsFor = function(groupMapper, callback) exports.createGroupIfNotExistsFor = function(groupMapper, callback)
{ {
@ -146,7 +149,7 @@ exports.createGroupIfNotExistsFor = function(groupMapper, callback)
if(ERR(err, callback)) return; if(ERR(err, callback)) return;
//there is no group for this mapper, let's create a group //there is no group for this mapper, let's create a group
if(groupID == null) if(!groupID)
{ {
exports.createGroup(function(err, responseObj) exports.createGroup(function(err, responseObj)
{ {
@ -165,7 +168,7 @@ exports.createGroupIfNotExistsFor = function(groupMapper, callback)
callback(null, {groupID: groupID}); callback(null, {groupID: groupID});
} }
}); });
} };
exports.createGroupPad = function(groupID, padName, text, callback) exports.createGroupPad = function(groupID, padName, text, callback)
{ {
@ -181,7 +184,7 @@ exports.createGroupPad = function(groupID, padName, text, callback)
if(ERR(err, callback)) return; if(ERR(err, callback)) return;
//group does not exist //group does not exist
if(exists == false) if(!exists)
{ {
callback(new customError("groupID does not exist","apierror")); callback(new customError("groupID does not exist","apierror"));
} }
@ -200,7 +203,7 @@ exports.createGroupPad = function(groupID, padName, text, callback)
if(ERR(err, callback)) return; if(ERR(err, callback)) return;
//pad exists already //pad exists already
if(exists == true) if(exists)
{ {
callback(new customError("padName does already exist","apierror")); callback(new customError("padName does already exist","apierror"));
} }
@ -231,7 +234,7 @@ exports.createGroupPad = function(groupID, padName, text, callback)
if(ERR(err, callback)) return; if(ERR(err, callback)) return;
callback(null, {padID: padID}); callback(null, {padID: padID});
}); });
} };
exports.listPads = function(groupID, callback) exports.listPads = function(groupID, callback)
{ {
@ -240,7 +243,7 @@ exports.listPads = function(groupID, callback)
if(ERR(err, callback)) return; if(ERR(err, callback)) return;
//group does not exist //group does not exist
if(exists == false) if(!exists)
{ {
callback(new customError("groupID does not exist","apierror")); callback(new customError("groupID does not exist","apierror"));
} }
@ -254,7 +257,7 @@ exports.listPads = function(groupID, callback)
}); });
} }
}); });
} };
/** /**
* Generates a random String with the given length. Is needed to generate the Author Ids * Generates a random String with the given length. Is needed to generate the Author Ids