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.

83 lines
1.6 KiB

/**
* UserActivityController
*
* @description :: Server-side logic for managing useractivities
* @help :: See http://sailsjs.org/#!/documentation/concepts/Controllers
*/
module.exports = {
search: function(req, res) {
var word = req.param('query'),
refQuery = UserActivity.find();
if (word != undefined)
refQuery = UserActivity.find({
where: {
or: [
{team: word},
{username: word}
]
},
sort: {
date: 1
}
});
refQuery.limit(10).exec(function(err, items) {
if (err) {
res.send(400);
} else {
res.send(items);
}
});
},
oneteam: function(req, res) {
var teamQ = req.param('team'),
refQuery = UserActivity.find();
if (teamQ != undefined)
refQuery = UserActivity.find({
team: teamQ,
sort: {
date: -1
}
});
refQuery.limit(10).exec(function(err, items) {
if (err) {
res.send(400);
} else {
res.send(items);
}
});
},
oneuser: function(req, res) {
var teamQ = req.param('team'),
usernameQ = req.param('username'),
refQuery = UserActivity.find();
if ((teamQ != undefined) && (usernameQ != undefined))
refQuery = UserActivity.find({
team: teamQ,
username: usernameQ,
sort: {
date: -1
}
});
refQuery.limit(10).exec(function(err, items) {
if (err) {
res.send(400);
} else {
res.send(items);
}
});
}
};