1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2025-12-17 03:41:33 +00:00

Adding a search to the admin panel

This commit is contained in:
Scott Tolksdorf
2016-05-17 22:48:06 -04:00
parent 5f55a59042
commit fc3587d6cb
3 changed files with 91 additions and 2 deletions

View File

@@ -98,7 +98,18 @@ module.exports = function(app){
var page = req.query.page || 0;
var count = req.query.count || 20;
HomebrewModel.find({}, {
var query = {};
if(req.query && req.query.id){
query = {
"$or" : [{
editId : req.query.id
},{
shareId : req.query.id
}]
};
}
HomebrewModel.find(query, {
text : 0 //omit the text
}, {
skip: page*count,