diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-12-08 02:52:19 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-12-08 02:56:41 +0100 |
| commit | 192abb9db60f95968953b515ce18700c6b2da090 (patch) | |
| tree | e0e77c935ad95ca9e641c6a1f19a22556df9b8d2 /bucky/db/index.js | |
| parent | bbbd8bbab8737f5067c85376daf79cd8a5a9c4cb (diff) | |
snippets and middleware
Diffstat (limited to 'bucky/db/index.js')
| -rw-r--r-- | bucky/db/index.js | 6 |
1 files changed, 6 insertions, 0 deletions
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') } |
