0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 18:32:41 +00:00

Add Notification lookup to Admin API

This commit is contained in:
G.Ambatte
2023-01-04 22:52:37 +13:00
parent 620cb95ae8
commit b8fd8a7a86

View File

@@ -1,4 +1,5 @@
const HomebrewModel = require('./homebrew.model.js').model;
const NotificationModel = require('./notifications.model.js').model;
const router = require('express').Router();
const Moment = require('moment');
//const render = require('vitreum/steps/render');
@@ -99,6 +100,15 @@ router.get('/admin/stats', mw.adminOnly, (req, res)=>{
});
});
/* Searches for matching edit or share id, also attempts to partial match */
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);
});
});
router.get('/admin', mw.adminOnly, (req, res)=>{
templateFn('admin', {
url : req.originalUrl