mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-28 04:52:40 +00:00
basic functionality
This commit is contained in:
@@ -78,7 +78,26 @@ router.get('/admin/lookup/:id', mw.adminOnly, async (req, res, next) => {
|
||||
});
|
||||
|
||||
|
||||
|
||||
/* Searches for matching title, also attempts to partial match */
|
||||
router.get('/admin/archive/:title', mw.adminOnly, async (req, res, next) => {
|
||||
try {
|
||||
const brews = await HomebrewModel.find({
|
||||
title: { $regex: req.params.title, $options: 'i' },
|
||||
published: true
|
||||
}).exec();
|
||||
|
||||
if (!brews || brews.length === 0) {
|
||||
// No published documents found with the given title
|
||||
return res.status(404).json({ error: 'Published documents not found' });
|
||||
}
|
||||
|
||||
return res.json(brews);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return res.status(500).json({ error: 'Internal Server Error' });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* Find 50 brews that aren't compressed yet */
|
||||
router.get('/admin/finduncompressed', mw.adminOnly, (req, res)=>{
|
||||
|
||||
Reference in New Issue
Block a user