From 694dbdf6ff3eef3e33fcbe95ebd676eea3353dcc Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 7 Sep 2015 02:17:51 -0400 Subject: linking urls --- lib/db/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/db/index.js') diff --git a/lib/db/index.js b/lib/db/index.js index 7452f3d..1ebae57 100644 --- a/lib/db/index.js +++ b/lib/db/index.js @@ -88,14 +88,15 @@ db.getFileSizes = function(ids){ /* COMMENTS */ -db.getCommentsForThread = function (id, limit, offset){ +db.getCommentsForThread = function (id, limit, offset, order){ + order = order || "asc" return Comment.query(function(qb){ - qb.where("thread", "=", id).orderBy("id", "asc") + qb.where("thread", "=", id).orderBy("id", order) if (limit) { - qb = qb.limit(limit) + qb.limit(limit) } if (offset) { - qb = qb.offset(offset) + qb.offset(offset) } }).fetchAll().then(function(comments){ comments.forEach(function(comment){ -- cgit v1.2.3-70-g09d2