router.use((req, res, next) => { if (!req.user) { res.status(401).json({ error: 'Unauthorized' }); return; } next(); });
router.use('/', (req, res, next) => { const validation = joi.validate(req.body, authValidation); if (!validation.error) { next(); } else { res.status(422).json({ message: 'Validation error.', error: validation.error, }); } });
router.use((req, res, next) => { if (!req.user || !req.user.isAdmin) { res.status(401).json({ error: 'Unauthorized' }); return; } next(); });
router.use((req, res, next) => { if (!req.user) { res.status(401).json({ error: 'Unauthorized' }); return; } next(); });
router.use((req, res, next) => { if (!req.user) { res.status(401).json({ error: 'Unauthorized' }); return; } next(); });
router.use((req, res, next) => { if (!req.user || !req.user.isAdmin) { res.status(401).json({ error: 'Unauthorized' }); return; } next(); });
router.use((req, res, next) => { if (!req.user || !req.user.isAdmin) { res.status(401).json({ error: 'Unauthorized' }); return; } next(); });
router.use((req, res, next) => { if (!req.user) { res.status(401).json({ error: 'Unauthorized' }); return; } next(); });