expressa 2.0.10 → 2.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/util.js +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expressa",
3
- "version": "2.0.10",
3
+ "version": "2.0.11",
4
4
  "description": "API framework using JSON schemas",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/thomas4019/expressa",
package/util.js CHANGED
@@ -203,11 +203,11 @@ exports.mongoToPostgres = mongoToPostgres
203
203
  // paging requires orderby to include a field that is known to be unique and constant
204
204
  // to ensure consistent results from database with offset and limit. Chosen field should
205
205
  // also represent a preferred ordering when doing final sort
206
- exports.orderByForPagedRequests = function(orderby, finalSortField = 'meta.created') {
206
+ exports.orderByForPagedRequests = function(orderby, finalSortField = 'meta.created', finalSortDirection = 1) {
207
207
  orderby = exports.normalizeOrderBy(orderby || {})
208
208
  const allFields = orderby.map(([field]) => field)
209
209
  if (!allFields.includes(finalSortField)) {
210
- orderby.push([finalSortField, 1])
210
+ orderby.push([finalSortField, finalSortDirection])
211
211
  }
212
212
  return orderby
213
213
  }