refactor: getOperatorId return value

This commit is contained in:
José Oliveira 2022-05-02 12:19:29 +01:00
parent 5b38ac2636
commit 74b3c1a9ce
4 changed files with 4 additions and 4 deletions

View file

@ -133,7 +133,7 @@ function sendRadar (data) {
function mapRecord (rates, settings) {
const timestamp = new Date().toISOString()
return Promise.all([getMachines(rates, settings), getOperatorId('coinatmradar')])
.then(([machines, { operatorId }]) => {
.then(([machines, operatorId]) => {
return {
operatorId: operatorId,
operator: {

View file

@ -2,7 +2,7 @@ const { getOperatorId } = require('../operator')
function findOperatorId (req, res, next) {
return getOperatorId('middleware')
.then(({ operatorId }) => {
.then(operatorId => {
res.locals.operatorId = operatorId
return next()
})

View file

@ -9,7 +9,7 @@ const { getOperatorId } = require('../../operator')
const hostname = options.hostname
router.use('*', async (req, res, next) => getOperatorId('authentication').then(({ operatorId }) => session({
router.use('*', async (req, res, next) => getOperatorId('authentication').then(operatorId => session({
store: new PgSession({
pgPromise: db,
tableName: USER_SESSIONS_TABLE_NAME

View file

@ -4,7 +4,7 @@ const _ = require('lodash/fp')
function getOperatorId (service) {
const sql = `SELECT operator_id FROM operator_ids WHERE service = '${service}'`
return db.oneOrNone(sql)
.then(_.mapKeys(_.camelCase))
.then(_.get('operator_id'))
}
module.exports = { getOperatorId }