Merge pull request #979 from johnyma22/develop

Add getAuthorName API endpoint
This commit is contained in:
John McLear 2012-09-04 08:27:18 -07:00
commit 890dbfde95
3 changed files with 21 additions and 0 deletions

View File

@ -47,6 +47,7 @@ exports.createGroupPad = groupManager.createGroupPad;
exports.createAuthor = authorManager.createAuthor; exports.createAuthor = authorManager.createAuthor;
exports.createAuthorIfNotExistsFor = authorManager.createAuthorIfNotExistsFor; exports.createAuthorIfNotExistsFor = authorManager.createAuthorIfNotExistsFor;
exports.getAuthorName = authorManager.getAuthorName;
exports.listPadsOfAuthor = authorManager.listPadsOfAuthor; exports.listPadsOfAuthor = authorManager.listPadsOfAuthor;
exports.padUsers = padMessageHandler.padUsers; exports.padUsers = padMessageHandler.padUsers;
exports.padUsersCount = padMessageHandler.padUsersCount; exports.padUsersCount = padMessageHandler.padUsersCount;

View File

@ -141,6 +141,25 @@ exports.getAuthor = function (author, callback)
db.get("globalAuthor:" + 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 * Returns the color Id of the author
* @param {String} author The id of the author * @param {String} author The id of the author

View File

@ -67,6 +67,7 @@ var functions = {
"isPasswordProtected" : ["padID"], "isPasswordProtected" : ["padID"],
"listAuthorsOfPad" : ["padID"], "listAuthorsOfPad" : ["padID"],
"padUsersCount" : ["padID"], "padUsersCount" : ["padID"],
"getAuthorName" : ["authorID"],
"padUsers" : ["padID"], "padUsers" : ["padID"],
"sendClientsMessage" : ["padID", "msg"] "sendClientsMessage" : ["padID", "msg"]
}; };