diff options
Diffstat (limited to 'lib/db/index.js')
| -rw-r--r-- | lib/db/index.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/db/index.js b/lib/db/index.js index 2c8486b..994187e 100644 --- a/lib/db/index.js +++ b/lib/db/index.js @@ -83,8 +83,23 @@ db.getCommentsForThread = function (id, limit, offset){ if (offset) { qb = qb.offset(offset) } - }).fetchAll() + }).fetchAll().then(function(comments){ + comments.forEach(function(comment){ + comment.set("comment", comment.get("comment").toString() ) + }) + return comments + }) } db.getCommentCounts = function(ids){ return knex.column('thread').count('* as count').select().from('comments').where('thread', 'in', ids).groupBy('thread') } + +/* PRIVATE MESSAGES */ + +db.getMessage = function (id){ + var model = new Message({'id': id}) + return model.fetch().then(function(message){ + message.set("body", message.get("body").toString() ) + return message + }) +}
\ No newline at end of file |
