mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-16 23:22:40 +00:00
remove lookup by id and admin access middleware from lookup all
This commit is contained in:
@@ -141,21 +141,7 @@ router.get('/admin/stats', mw.adminOnly, async (req, res)=>{
|
|||||||
|
|
||||||
// ####################### NOTIFICATIONS
|
// ####################### NOTIFICATIONS
|
||||||
|
|
||||||
/* Searches for notification with matching key */
|
router.get('/admin/notification/all', async (req, res, next) => {
|
||||||
router.get('/admin/notification/lookup/:id', mw.adminOnly, async (req, res, next) => {
|
|
||||||
try {
|
|
||||||
const notification = await NotificationModel.findOne({ dismissKey: req.params.id }).exec();
|
|
||||||
if (!notification) {
|
|
||||||
return res.status(404).json({ message: 'Notification not found' });
|
|
||||||
}
|
|
||||||
return res.json(notification);
|
|
||||||
} catch (err) {
|
|
||||||
return next(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// get all notifications
|
|
||||||
router.get('/admin/notification/all', mw.adminOnly, async (req, res, next) => {
|
|
||||||
try {
|
try {
|
||||||
const notifications = await NotificationModel.getAll();
|
const notifications = await NotificationModel.getAll();
|
||||||
return res.json(notifications);
|
return res.json(notifications);
|
||||||
|
|||||||
Reference in New Issue
Block a user