1
0
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:
Scott Tolksdorf
2017-01-28 12:25:26 -05:00
parent 26bcb3395a
commit 75111acefb
6 changed files with 289 additions and 117 deletions

View File

@@ -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