mirror of
https://github.com/stolksdorf/homebrewery.git
synced 2025-12-22 01:11:29 +00:00
Added tests for admin routes, lookup is working
This commit is contained in:
@@ -29,26 +29,19 @@ router.delete('/admin/invalid', mw.adminOnly, (req, res, next)=>{
|
||||
.catch(next);
|
||||
});
|
||||
|
||||
router.get('/admin/lookup/:search', (req, res) => {
|
||||
router.get('/admin/lookup/:search', mw.adminOnly, (req, res, next) => {
|
||||
//search for mathcing edit id
|
||||
//search for matching share id
|
||||
// search for partial match
|
||||
|
||||
BrewData.get({editId : req.params.search})
|
||||
.then((brew) => {
|
||||
|
||||
})
|
||||
|
||||
BrewData.get({ $or:[
|
||||
{editId : { "$regex": req.params.search, "$options": "i" }},
|
||||
{shareId : { "$regex": req.params.search, "$options": "i" }},
|
||||
]})
|
||||
.then((brews) => {
|
||||
console.log(brews);
|
||||
return res.json(brews);
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
.catch(next);
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
Reference in New Issue
Block a user