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.
18 lines
498 B
JavaScript
18 lines
498 B
JavaScript
5 years ago
|
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()
|
||
|
return parseFloat(current.default_tax_percent)
|
||
|
}
|