const settings = require('../../../model/settings/settings.model') // The logger module exports a FACTORY — calling it is what yields {error, warn, // info, debug}. Using the factory directly makes `log.error` undefined, which // would turn a DB fault into a TypeError thrown inside the catch (no response // sent, request left hanging) instead of a 500. const log = require('../../../utils/logger')('settings') // The nav overrides for the two authenticated layouts. Values are the raw stored // JSON strings (settings.value is TEXT) or null; the caller parses them with the // same fail-safe posture as every other JSON setting — malformed reads as // absent, and absent means the hardcoded NAV array is used unchanged. async function getNav(req, res) { try { return res.json(await settings.getNav()) } catch (err) { log.error('getNav', err) return res.status(500).json({ message: 'Internal Server Error' }) } } module.exports = { getNav }