refactor: drop one .then() use and lodash/fp

This commit is contained in:
siiky 2025-06-03 11:36:03 +01:00
parent 49080b0412
commit afe8299ae7

View file

@ -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 }