From 192abb9db60f95968953b515ce18700c6b2da090 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 8 Dec 2017 02:52:19 +0100 Subject: snippets and middleware --- bucky/db/index.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bucky/db/index.js') diff --git a/bucky/db/index.js b/bucky/db/index.js index f376308..dcd5f20 100644 --- a/bucky/db/index.js +++ b/bucky/db/index.js @@ -92,6 +92,9 @@ db.getFileCounts = function(ids){ 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) +} db.createFile = function(data){ return new db.File(data).save() } @@ -117,6 +120,9 @@ db.getCommentsForThread = function (id, limit, offset, order){ return comments }) } +db.getCommentsById = function(ids){ + return Comment.where("id", "in", ids) +} 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