You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
553 B
JavaScript

const pg = require('../pg')
const joinjs = require('join-js').default;
const debug = require('debug')('sos:db:config')
const mappings = require('../mappings')
const config = module.exports = {}
config.getLatestConfig = async () => {
const {rows} = await pg.query('select * from sos.v_config')
return joinjs.mapOne(rows, mappings, 'configMap', 'config_')
}
config.getTaxRate = async () => {
const current = await config.getLatestConfig()
console.log(parseFloat(current.default_tax_percent))
return parseFloat(current.default_tax_percent)
}