Merge pull request #979 from johnyma22/develop
Add getAuthorName API endpoint
This commit is contained in:
commit
890dbfde95
|
@ -47,6 +47,7 @@ exports.createGroupPad = groupManager.createGroupPad;
|
|||
|
||||
exports.createAuthor = authorManager.createAuthor;
|
||||
exports.createAuthorIfNotExistsFor = authorManager.createAuthorIfNotExistsFor;
|
||||
exports.getAuthorName = authorManager.getAuthorName;
|
||||
exports.listPadsOfAuthor = authorManager.listPadsOfAuthor;
|
||||
exports.padUsers = padMessageHandler.padUsers;
|
||||
exports.padUsersCount = padMessageHandler.padUsersCount;
|
||||
|
|
|
@ -141,6 +141,25 @@ exports.getAuthor = function (author, callback)
|
|||
db.get("globalAuthor:" + author, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Author Name of the author
|
||||
* @param {String} author The id of the author
|
||||
* @param {Function} callback callback(err, name)
|
||||
*/
|
||||
|
||||
exports.getAuthorName = function (authorID, callback)
|
||||
{
|
||||
db.getSub("globalAuthor:" + author, ["name"], callback);
|
||||
console.log(authorID);
|
||||
db.getSub("globalAuthor:" + authorID, ["name"], function(err, authorName){
|
||||
if(ERR(err, callback)) return;
|
||||
console.log(authorName);
|
||||
callback(null, {authorName: authorName});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the color Id of the author
|
||||
* @param {String} author The id of the author
|
||||
|
|
|
@ -67,6 +67,7 @@ var functions = {
|
|||
"isPasswordProtected" : ["padID"],
|
||||
"listAuthorsOfPad" : ["padID"],
|
||||
"padUsersCount" : ["padID"],
|
||||
"getAuthorName" : ["authorID"],
|
||||
"padUsers" : ["padID"],
|
||||
"sendClientsMessage" : ["padID", "msg"]
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue