summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/db/crud.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/db/crud.js b/lib/db/crud.js
index 0ee438d..3aa0127 100644
--- a/lib/db/crud.js
+++ b/lib/db/crud.js
@@ -11,13 +11,13 @@ module.exports = function(model) {
if (q.offset) {
delete q.offset
}
+ delete q.orderBy
if (Object.keys(q).length > 0) qb.where(q)
if (orderBy) {
const ob = orderBy.split(" ")
const ob_field = ob[0] || 'id'
const ob_dir = ob[1] || 'desc'
qb.orderBy(ob_field, ob_dir)
- delete q.orderBy
}
if (limit) qb.limit( limit )
if (offset) qb.offset( offset )
@@ -44,4 +44,4 @@ module.exports = function(model) {
return new model({'id': id}).destroy()
},
}
-} \ No newline at end of file
+}