summaryrefslogtreecommitdiff
path: root/lib/db/index.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-03-31 15:11:22 +0200
committerJules Laplace <julescarbon@gmail.com>2018-03-31 15:11:22 +0200
commit6feecf8d38944067963435be1524f1b532bec38c (patch)
tree80311945debe1cc280496bd88b0471d7c28f39be /lib/db/index.js
parentad6fff63c69a529096b5ea9d1fc81bd9e95bb54d (diff)
parent19d8a1315cfaa51cb342570cd31df525e56e0513 (diff)
Merge branch 'master' of ghghgh.us:luckyplop
Diffstat (limited to 'lib/db/index.js')
-rw-r--r--lib/db/index.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/db/index.js b/lib/db/index.js
index ffd8c27..6e36602 100644
--- a/lib/db/index.js
+++ b/lib/db/index.js
@@ -31,14 +31,14 @@ db.getRandom = function () {
}
db.getRandomAscii = function () {
return ShaderImage.query(function(qb){
- qb.where("tag", "=", "ascii").orderBy(knex.raw('RAND()')).limit(1)
+ qb.where("tag", "ascii").orderBy(knex.raw('RAND()')).limit(1)
}).fetch()
}
db.getIndex = function(limit, offset) {
return Image.query(function(qb){
qb.orderBy("id", "desc").limit(limit)
if (offset) qb.offset(offset)
- }).fetch()
+ }).fetchAll()
}
db.createImage = function(url){
return new Image({ url: url }).save()