Fix: fix linter-found issues Chore: move findOperatorId to own middleware file Chore: delete old routes.js file and rename new-routes.js to routes.js Fix: PR fixes
26 lines
770 B
JavaScript
26 lines
770 B
JavaScript
const _ = require('lodash/fp')
|
|
const state = require('./state')
|
|
|
|
const getTimestamp = (operatorId) => state.settingsCache[operatorId] ? state.settingsCache[operatorId].timestamp : null
|
|
|
|
const getCache = (operatorId) => state.settingsCache[operatorId] ? state.settingsCache[operatorId].cache : null
|
|
|
|
const setTimestamp = (operatorId, newTimestamp) => {
|
|
state.settingsCache = _.set([operatorId, 'timestamp'], newTimestamp, state.settingsCache)
|
|
}
|
|
|
|
const setCache = (operatorId, newCache) => {
|
|
state.settingsCache = _.set([operatorId, 'cache'], newCache, state.settingsCache)
|
|
}
|
|
|
|
const clear = (operatorId) => {
|
|
state.settingsCache = _.set([operatorId], null, state.settingsCache)
|
|
}
|
|
|
|
module.exports = {
|
|
getTimestamp,
|
|
getCache,
|
|
setTimestamp,
|
|
setCache,
|
|
clear
|
|
}
|