From fcfe16d5ebb8ae615ba3d1856446cda6daf6b020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Oliveira?= Date: Tue, 9 Feb 2021 13:13:45 +0000 Subject: [PATCH] Refactored to use loadAccounts --- lib/new-settings-loader.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/new-settings-loader.js b/lib/new-settings-loader.js index 018fa625..4c26db2f 100644 --- a/lib/new-settings-loader.js +++ b/lib/new-settings-loader.js @@ -54,17 +54,8 @@ function loadAccounts (schemaVersion) { } function showAccounts (schemaVersion) { - const sql = `select data - from user_config - where type=$1 - and schema_version=$2 - and valid - order by id desc - limit 1` - - return db.oneOrNone(sql, ['accounts', schemaVersion || NEW_SETTINGS_LOADER_SCHEMA_VERSION]) - .then(res => { - const accounts = _.compose(_.defaultTo({}), _.get('data.accounts'))(res) + return loadAccounts(schemaVersion) + .then(accounts => { const filledSecretPaths = _.compact(_.map(path => { if (!_.isEmpty(_.get(path, accounts))) { return path