This commit is contained in:
Josh Harvey 2016-11-27 03:09:51 +02:00
parent 7e5515a873
commit b16d11045c
10 changed files with 368 additions and 550 deletions

View file

@ -1,31 +1,10 @@
var R = require('ramda')
var db = require('./db')
function load () {
return db.one('select data from user_config where type=$1', 'config')
.then(function (data) {
return data.data
})
}
function loadAccounts () {
const toFields = fieldArr => R.fromPairs(R.map(r => [r.code, r.value], fieldArr))
const toPairs = r => [r.code, toFields(r.fields)]
return db.oneOrNone('select data from user_config where type=$1', 'accounts')
.then(function (data) {
if (!data) return {}
return R.fromPairs(R.map(toPairs, data.data.accounts))
})
}
const R = require('ramda')
module.exports = {
load,
unscoped,
cryptoScoped,
machineScoped,
scoped,
loadAccounts
scoped
}
function matchesValue (crypto, machine, instance) {