summaryrefslogtreecommitdiff
path: root/bucky/db/index.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-12-08 05:37:20 +0100
committerJules Laplace <julescarbon@gmail.com>2017-12-08 05:37:20 +0100
commit9978bb56fc2c56ad52930bde9bcaa561158a158a (patch)
tree0998cfc21091c6923b0bf3988a35ff82f1e58e98 /bucky/db/index.js
parentdd45551e4bf64ba472976b60986b9273449aae70 (diff)
searches working correctly
Diffstat (limited to 'bucky/db/index.js')
-rw-r--r--bucky/db/index.js7
1 files changed, 5 insertions, 2 deletions
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')