fix: remove sanction loader middleware
This commit is contained in:
parent
c77fda2623
commit
d76e84428f
4 changed files with 30 additions and 37 deletions
|
|
@ -1,11 +1,9 @@
|
|||
const cleanUserSessions = require('./cleanUserSessions')
|
||||
const buildApolloContext = require('./context')
|
||||
const loadSanctionLists = require('./loadSanctionLists')
|
||||
const session = require('./session')
|
||||
|
||||
module.exports = {
|
||||
cleanUserSessions,
|
||||
buildApolloContext,
|
||||
loadSanctionLists,
|
||||
session
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
const logger = require('../../logger')
|
||||
const sanctions = require('../../ofac')
|
||||
|
||||
const sanctionStatus = {
|
||||
loaded: false,
|
||||
timestamp: null
|
||||
}
|
||||
|
||||
const loadSanctionLists = (req, res, next) => {
|
||||
if (!sanctionStatus.loaded) {
|
||||
logger.info('No sanction lists loaded. Loading sanctions...')
|
||||
return sanctions.load()
|
||||
.then(() => {
|
||||
logger.info('OFAC sanction list loaded!')
|
||||
sanctionStatus.loaded = true
|
||||
sanctionStatus.timestamp = Date.now()
|
||||
return next()
|
||||
})
|
||||
.catch(e => {
|
||||
logger.error('Couldn\'t load OFAC sanction list!')
|
||||
return next(e)
|
||||
})
|
||||
}
|
||||
|
||||
return next()
|
||||
}
|
||||
|
||||
module.exports = loadSanctionLists
|
||||
Loading…
Add table
Add a link
Reference in a new issue