This is a supporter for getblackboard.com; mainly for static API services. Let's see if this evolves into something else or not.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.5 KiB

/**
* ObjRevisionController
*
* @description :: Server-side logic for managing objrevisions
* @help :: See http://sailsjs.org/#!/documentation/concepts/Controllers
*/
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);
}
});
}
};