From 9978bb56fc2c56ad52930bde9bcaa561158a158a Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 8 Dec 2017 05:37:20 +0100 Subject: searches working correctly --- bucky/db/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bucky/db/index.js') diff --git a/bucky/db/index.js b/bucky/db/index.js index dcd5f20..f7adb7a 100644 --- a/bucky/db/index.js +++ b/bucky/db/index.js @@ -73,6 +73,9 @@ db.getThreadsForKeyword = function (keyword) { db.getThread = function (id) { return Thread.query("where", "id", "=", id).fetch() } +db.getThreadsById = function(ids){ + return Thread.where("id", "in", ids).fetchAll() +} db.createThread = function(data){ return new db.Thread(data).save() } @@ -93,7 +96,7 @@ db.getFileSizes = function(ids){ return knex.column('thread').sum('size as size').select().from('files').where('thread', 'in', ids).groupBy('thread') } db.getFilesById = function(ids){ - return File.where("id", "in", ids) + return File.where("id", "in", ids).fetchAll() } db.createFile = function(data){ return new db.File(data).save() @@ -121,7 +124,7 @@ db.getCommentsForThread = function (id, limit, offset, order){ }) } db.getCommentsById = function(ids){ - return Comment.where("id", "in", ids) + return Comment.where("id", "in", ids).fetchAll() } db.getCommentCounts = function(ids){ return knex.column('thread').count('* as count').select().from('comments').where('thread', 'in', ids).groupBy('thread') -- cgit v1.2.3-70-g09d2