bug fixes
This commit is contained in:
parent
f2a95e291a
commit
985e3811e3
14 changed files with 758 additions and 78 deletions
|
|
@ -1,27 +1,10 @@
|
|||
const _ = require('lodash/fp')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const options = require('../options')
|
||||
const db = require('../db')
|
||||
const config = require('./config')
|
||||
const pu = require('../plugin-helper')
|
||||
|
||||
const accountRoot = options.pluginPath
|
||||
const schemas = {}
|
||||
|
||||
function fetchSchemas () {
|
||||
const files = fs.readdirSync(accountRoot)
|
||||
|
||||
files.forEach(file => {
|
||||
if (file.indexOf('lamassu-') !== 0) return
|
||||
|
||||
try {
|
||||
const schema = JSON.parse(fs.readFileSync(path.resolve(accountRoot, file, 'schema.json')))
|
||||
schemas[schema.code] = schema
|
||||
} catch (_) {
|
||||
}
|
||||
})
|
||||
}
|
||||
const schemas = pu.loadSchemas()
|
||||
|
||||
function fetchAccounts () {
|
||||
return db.oneOrNone('select data from user_config where type=$1', ['accounts'])
|
||||
|
|
@ -121,8 +104,6 @@ function updateAccount (account) {
|
|||
.then(() => getAccount(account.code))
|
||||
}
|
||||
|
||||
fetchSchemas()
|
||||
|
||||
module.exports = {
|
||||
selectedAccounts,
|
||||
getAccount,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue