diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-12-08 01:35:26 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-12-08 01:35:26 +0100 |
| commit | e4e0cf21a31b74d5ee1e6d45b343ea60ed44f372 (patch) | |
| tree | d6e3d14c4b5ddfed5d8bd036a5eba29af505553b /lib/db/index.js | |
| parent | 3a4f027ec05aa5fdf4098ceb0dab09f69c5e0b8b (diff) | |
hootbox stuff
Diffstat (limited to 'lib/db/index.js')
| -rw-r--r-- | lib/db/index.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/db/index.js b/lib/db/index.js index 6906b27..f376308 100644 --- a/lib/db/index.js +++ b/lib/db/index.js @@ -62,7 +62,7 @@ db.getLastlog = function(limit){ db.getLatestThreads = function () { return Thread.query(function(qb){ - qb.orderBy("id", "desc").limit(50) + qb.orderBy("lastmodified", "desc").limit(50) }).fetchAll() } db.getThreadsForKeyword = function (keyword) { @@ -74,6 +74,7 @@ db.getThread = function (id) { return Thread.query("where", "id", "=", id).fetch() } db.createThread = function(data){ + return new db.Thread(data).save() } db.updateThread = function(data){ } @@ -92,6 +93,7 @@ db.getFileSizes = function(ids){ return knex.column('thread').sum('size as size').select().from('files').where('thread', 'in', ids).groupBy('thread') } db.createFile = function(data){ + return new db.File(data).save() } db.removeFile = function(id){ } @@ -119,6 +121,7 @@ db.getCommentCounts = function(ids){ return knex.column('thread').count('* as count').select().from('comments').where('thread', 'in', ids).groupBy('thread') } db.createComment = function(data){ + return new db.Comment(data).save() } db.updateComment = function(data){ } @@ -135,6 +138,7 @@ db.getKeyword = function (keyword) { return Keyword.query("where", "keyword", "=", keyword).fetch() } db.createKeyword = function(data){ + return new db.Keyword(data).save() } db.updateKeyword = function(data){ } @@ -175,6 +179,7 @@ db.getMessage = function (id){ }) } db.createMessage = function(data){ + return new db.Message(data).save() } db.updateMessage = function(data){ } |
