Merge pull request #1787 from RafaelTaranto/fix/wallet-settings-errors

LAM-1265 fix: wallet settings wrong error
This commit is contained in:
Rafael Taranto 2025-02-15 07:19:06 +00:00 committed by GitHub
commit 51d6a40946

View file

@ -2,12 +2,10 @@ const crypto = require('crypto')
const _ = require('lodash/fp')
const db = require('./db')
const migration = require('./config-migration')
const { asyncLocalStorage } = require('./async-storage')
const { getOperatorId } = require('./operator')
const { getTermsConditions, setTermsConditions } = require('./new-config-manager')
const OLD_SETTINGS_LOADER_SCHEMA_VERSION = 1
const NEW_SETTINGS_LOADER_SCHEMA_VERSION = 2
const PASSWORD_FILLED = 'PASSWORD_FILLED'
const SECRET_FIELDS = [
@ -63,6 +61,10 @@ const notifyReload = (dbOrTx, operatorId) =>
)
function saveAccounts (accounts) {
if (!accounts) {
return Promise.resolve()
}
const accountsSql = `UPDATE user_config SET data = $1, valid = TRUE, schema_version = $2 WHERE type = 'accounts';
INSERT INTO user_config (type, data, valid, schema_version)
SELECT 'accounts', $1, TRUE, $2 WHERE 'accounts' NOT IN (SELECT type FROM user_config)`