refactor: drop one .then() use and lodash/fp
This commit is contained in:
parent
49080b0412
commit
afe8299ae7
1 changed files with 1 additions and 2 deletions
|
|
@ -1,9 +1,8 @@
|
||||||
const db = require('./db')
|
const db = require('./db')
|
||||||
const _ = require('lodash/fp')
|
|
||||||
|
|
||||||
function getOperatorId(service) {
|
function getOperatorId(service) {
|
||||||
const sql = 'SELECT operator_id FROM operator_ids WHERE service = ${service}'
|
const sql = 'SELECT operator_id FROM operator_ids WHERE service = ${service}'
|
||||||
return db.oneOrNone(sql, { service }).then(_.get('operator_id'))
|
return db.oneOrNone(sql, { service }, ({ operator_id }) => operator_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { getOperatorId }
|
module.exports = { getOperatorId }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue