db/Pad.js: convert to promises/async

Also updated some small chunks of dependent code that couldn't be converted
until this one had been done.
This commit is contained in:
Ray Bellis 2019-01-31 11:14:38 +00:00
parent ebb8a64e3c
commit 6d1b6b2796
4 changed files with 236 additions and 454 deletions

View file

@ -144,12 +144,11 @@ exports.getAuthor = function(author)
/**
* Returns the color Id of the author
* @param {String} author The id of the author
* @param {Function} callback callback(err, colorId)
*/
exports.getAuthorColorId = thenify(function(author, callback)
exports.getAuthorColorId = function(author)
{
db.db.getSub("globalAuthor:" + author, ["colorId"], callback);
});
return db.getSub("globalAuthor:" + author, ["colorId"]);
}
/**
* Sets the color Id of the author
@ -164,12 +163,11 @@ exports.setAuthorColorId = function(author, colorId)
/**
* Returns the name of the author
* @param {String} author The id of the author
* @param {Function} callback callback(err, name)
*/
exports.getAuthorName = thenify(function(author, callback)
exports.getAuthorName = function(author)
{
db.db.getSub("globalAuthor:" + author, ["name"], callback);
});
return db.getSub("globalAuthor:" + author, ["name"]);
}
/**
* Sets the name of the author