diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-04-04 21:44:26 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-04-04 21:44:26 +0200 |
| commit | d3a31c89081f7d2d268c53fef64c502407ef42bb (patch) | |
| tree | 0716404c61db49a495f19b31df4b8a57bf6db3b0 /bucky/db/index.js | |
| parent | da5de0257fc9c9d8c4c7f589d84ced2ef19b9f04 (diff) | |
user list
Diffstat (limited to 'bucky/db/index.js')
| -rw-r--r-- | bucky/db/index.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/bucky/db/index.js b/bucky/db/index.js index 53e36dd..312ca13 100644 --- a/bucky/db/index.js +++ b/bucky/db/index.js @@ -55,7 +55,7 @@ db.createUser = function(data){ } db.getUsers = function () { return User.query(function(qb){ - qb.orderBy("username", "desc") + qb.orderBy("username", "asc") }).fetchAll({ columns: [ "id", "username", "realname", "firstseen", "lastseen", @@ -148,6 +148,15 @@ db.getThreadUsers = function(thread_id){ db.getUserThreadIds = function(user_id){ return ThreadUser.query("where", "user_id", "=", user_id).fetch() } +db.getUserThreadCounts = function(ids){ + return knex.column('username').count('* as count').select().from('threads').groupBy('username') +} +db.getUserCommentCounts = function(ids){ + return knex.column('username').count('* as count').select().from('comments').groupBy('username') +} +db.getUserFileCounts = function(ids){ + return knex.column('username').sum('size as size').count('* as count').select().from('files').groupBy('username') +} /* FILES */ |
