From b8fd8a7a868a6674f971eb187578bc19fe7cd8b9 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Wed, 4 Jan 2023 22:52:37 +1300 Subject: [PATCH] Add Notification lookup to Admin API --- server/admin.api.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/admin.api.js b/server/admin.api.js index b9b2afbd7..7190f7076 100644 --- a/server/admin.api.js +++ b/server/admin.api.js @@ -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