0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 16:22:44 +00:00

Initial notificationAdd functionality

This commit is contained in:
G.Ambatte
2023-01-15 13:54:19 +13:00
parent 8adf5ce463
commit 04916d8931
4 changed files with 147 additions and 19 deletions

View File

@@ -100,13 +100,18 @@ router.get('/admin/stats', mw.adminOnly, (req, res)=>{
});
});
/* Searches for matching edit or share id, also attempts to partial match */
/* Searches for notification with matching key */
router.get('/admin/notification/lookup/:id', mw.adminOnly, (req, res, next)=>{
NotificationModel.findOne({ $or : [
{ dismissKey: { '$regex': req.params.id } },
] }).exec((err, notification)=>{
return res.json(notification);
});
NotificationModel.findOne({ dismissKey: req.params.id })
.exec((err, notification)=>{
return res.json(notification);
});
});
/* Add new notification */
router.post('/admin/notification/add', mw.adminOnly, async (req, res, next)=>{
const notification = await NotificationModel.addNotification(req.body);
return res.json(notification);
});
router.get('/admin', mw.adminOnly, (req, res)=>{