Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Commit

Permalink
Sort "get all items" response
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamVig committed Sep 25, 2017
1 parent f0fe7c9 commit ef6bbe6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions controllers/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ item.withActiveRental = (req, queryBuilder) => {
.where('rental.returnDate', null)
.orderBy('rental.startDate', 'ascending')
}

item.getAll = endpoint.getAll('item', {modify: item.withFieldsAndFilters})
// Criteria to sort items by
const sortBy = [
{column: 'brand', ascending: true},
{column: 'model', ascending: true}
]
item.getAll = endpoint.getAll('item', {modify: item.withFieldsAndFilters, sortBy})
item.get = endpoint.get('item', 'barcode',
{modify: item.withFieldsAndFilters, messages})
item.create = endpoint.create('item', 'barcode',
Expand Down

0 comments on commit ef6bbe6

Please sign in to comment.