AuthorManager: await for more db methods
parent
35797e57fc
commit
3a5af19492
|
@ -183,34 +183,35 @@ exports.createAuthor = async (name) => {
|
|||
* Returns the Author Obj of the author
|
||||
* @param {String} author The id of the author
|
||||
*/
|
||||
exports.getAuthor = (author) => db.get(`globalAuthor:${author}`);
|
||||
exports.getAuthor = async (author) => await db.get(`globalAuthor:${author}`);
|
||||
|
||||
/**
|
||||
* Returns the color Id of the author
|
||||
* @param {String} author The id of the author
|
||||
*/
|
||||
exports.getAuthorColorId = (author) => db.getSub(`globalAuthor:${author}`, ['colorId']);
|
||||
exports.getAuthorColorId = async (author) => await db.getSub(`globalAuthor:${author}`, ['colorId']);
|
||||
|
||||
/**
|
||||
* Sets the color Id of the author
|
||||
* @param {String} author The id of the author
|
||||
* @param {String} colorId The color id of the author
|
||||
*/
|
||||
exports.setAuthorColorId = (author, colorId) => db.setSub(
|
||||
exports.setAuthorColorId = async (author, colorId) => await db.setSub(
|
||||
`globalAuthor:${author}`, ['colorId'], colorId);
|
||||
|
||||
/**
|
||||
* Returns the name of the author
|
||||
* @param {String} author The id of the author
|
||||
*/
|
||||
exports.getAuthorName = (author) => db.getSub(`globalAuthor:${author}`, ['name']);
|
||||
exports.getAuthorName = async (author) => await db.getSub(`globalAuthor:${author}`, ['name']);
|
||||
|
||||
/**
|
||||
* Sets the name of the author
|
||||
* @param {String} author The id of the author
|
||||
* @param {String} name The name of the author
|
||||
*/
|
||||
exports.setAuthorName = (author, name) => db.setSub(`globalAuthor:${author}`, ['name'], name);
|
||||
exports.setAuthorName = async (author, name) => await db.setSub(
|
||||
`globalAuthor:${author}`, ['name'], name);
|
||||
|
||||
/**
|
||||
* Returns an array of all pads this author contributed to
|
||||
|
@ -260,7 +261,7 @@ exports.addPad = async (authorID, padID) => {
|
|||
author.padIDs[padID] = 1; // anything, because value is not used
|
||||
|
||||
// save the new element back
|
||||
db.set(`globalAuthor:${authorID}`, author);
|
||||
await db.set(`globalAuthor:${authorID}`, author);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue