mirror of
https://github.com/stolksdorf/homebrewery.git
synced 2025-12-30 16:41:28 +00:00
All tests should be done, phew
This commit is contained in:
@@ -6,10 +6,25 @@ const mw = require('./middleware.js');
|
||||
|
||||
//Search
|
||||
router.get('/api/brew', (req, res, next) => {
|
||||
const opts = _.pick(req.query, ['limit', 'sort', 'page']);
|
||||
|
||||
//TODO
|
||||
BrewData.termSearch(req.query.terms, opts, req.admin)
|
||||
.then((result) => {
|
||||
return res.status(200).json(result);
|
||||
})
|
||||
.catch(next);
|
||||
});
|
||||
|
||||
//User
|
||||
router.get('/api/user/:username', (req, res, next) => {
|
||||
const fullAccess = req.admin ||
|
||||
!!(req.account && req.params.username == req.account.username);
|
||||
|
||||
BrewData.userSearch(req.params.username, fullAccess)
|
||||
.then((result) => {
|
||||
return res.status(200).json(result);
|
||||
})
|
||||
.catch(next);
|
||||
});
|
||||
|
||||
//Get
|
||||
|
||||
Reference in New Issue
Block a user