From 3a5af19492ad3f85166f7dbecb47dab404794224 Mon Sep 17 00:00:00 2001 From: webzwo0i Date: Sun, 18 Apr 2021 00:56:22 +0200 Subject: [PATCH] AuthorManager: await for more db methods --- src/node/db/AuthorManager.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/node/db/AuthorManager.js b/src/node/db/AuthorManager.js index d56ba2f10..de868b97d 100644 --- a/src/node/db/AuthorManager.js +++ b/src/node/db/AuthorManager.js @@ -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); }; /**