AuthorManager: await for more db methods

pull/5011/head
webzwo0i 2021-04-18 00:56:22 +02:00 committed by Richard Hansen
parent 35797e57fc
commit 3a5af19492
1 changed files with 7 additions and 6 deletions

View File

@ -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);
};
/**