const { getInstanceSetting } = require('../models/helpers') const Entry = require('../models/entry') exports.enhanceLocals = async (req, res, next) => { res.locals.portalCode = await getInstanceSetting('portal_code') res.locals.flashInfo = req.flash('info') next() } exports.adjustHeaders = async (req, res, next) => { res.set('Cache-Control', 'no-cache, private') next() } exports.setDerivedDictionaryIdFromEntryId = async (req, res, next) => { const { entryId } = req.query const { dictionary_id: dictionaryId } = await Entry.fetch(entryId) req.derivedDictionaryId = dictionaryId next() }