2014-01-09 22:46:51 -05:00
|
|
|
var categories = require('../categories'),
|
|
|
|
|
|
|
|
|
|
SocketCategories = {};
|
|
|
|
|
|
2014-01-16 15:16:12 -05:00
|
|
|
SocketCategories.getRecentReplies = function(socket, tid, callback) {
|
|
|
|
|
categories.getRecentReplies(tid, socket.uid, 4, function(err, replies) {
|
2014-01-09 22:46:51 -05:00
|
|
|
callback(replies);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
2014-01-16 15:16:12 -05:00
|
|
|
SocketCategories.get = function(socket, data, callback) {
|
2014-01-09 22:46:51 -05:00
|
|
|
categories.getAllCategories(0, function(err, categories) {
|
|
|
|
|
if(callback) {
|
|
|
|
|
callback(categories);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
2014-01-16 15:16:12 -05:00
|
|
|
SocketCategories.loadMore = function(socket, data, callback) {
|
2014-01-09 22:46:51 -05:00
|
|
|
var start = data.after,
|
|
|
|
|
end = start + 9;
|
|
|
|
|
|
2014-01-16 15:16:12 -05:00
|
|
|
categories.getCategoryTopics(data.cid, start, end, socket.uid, function(topics) {
|
2014-01-09 22:46:51 -05:00
|
|
|
callback({
|
|
|
|
|
topics: topics
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.exports = SocketCategories;
|