|
|
@ -7,5 +7,69 @@ |
|
|
|
|
|
|
|
|
|
|
|
module.exports = { |
|
|
|
module.exports = { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
search: function(req, res) { |
|
|
|
|
|
|
|
var word = req.param('query'), |
|
|
|
|
|
|
|
revisionQuery = ObjRevision.find(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (word != undefined) |
|
|
|
|
|
|
|
revisionQuery = ObjRevision.find({ |
|
|
|
|
|
|
|
where: { |
|
|
|
|
|
|
|
or: [ |
|
|
|
|
|
|
|
{obj: {jarvisId: {contains: word}}}, |
|
|
|
|
|
|
|
{obj: {bbApi: {contains: word}}} |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
sort: { |
|
|
|
|
|
|
|
date: 1 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
revisionQuery.limit(10).exec(function(err, items) { |
|
|
|
|
|
|
|
if (err) { |
|
|
|
|
|
|
|
res.send(400); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
res.send(items); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jarvisid: function(req, res) { |
|
|
|
|
|
|
|
var word = req.param('query'), |
|
|
|
|
|
|
|
revisionQuery = ObjRevision.find(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (word != undefined) |
|
|
|
|
|
|
|
revisionQuery = ObjRevision.find({ |
|
|
|
|
|
|
|
jarvisId: word, |
|
|
|
|
|
|
|
sort: { date: 1} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
revisionQuery.limit(10).exec(function(err, items) { |
|
|
|
|
|
|
|
if (err) { |
|
|
|
|
|
|
|
res.send(400); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
res.send(items); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bbapi: function(req, res) { |
|
|
|
|
|
|
|
var word = req.param('query'), |
|
|
|
|
|
|
|
revisionQuery = ObjRevision.find(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (word != undefined) |
|
|
|
|
|
|
|
revisionQuery = ObjRevision.find({ |
|
|
|
|
|
|
|
bbApi: word, |
|
|
|
|
|
|
|
sort: { date: 1} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
revisionQuery.limit(10).exec(function(err, items) { |
|
|
|
|
|
|
|
if (err) { |
|
|
|
|
|
|
|
res.send(400); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
res.send(items); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|