Skip to content

Commit 5974ae3

Browse files
authored
Merge pull request #7 from yapplabs/feature/support-sort
Support sort params in store.query call
2 parents 3674254 + 4aa1d52 commit 5974ae3

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

addon/adapters/ember-data-utils-json-api.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export default DS.JSONAPIAdapter.extend({
5353
let jsonApiQuery = {};
5454
jsonApiQuery = this._applyPagination(jsonApiQuery, query);
5555
jsonApiQuery = this._applySupportedFilters(jsonApiQuery, query);
56+
jsonApiQuery = this._applySort(jsonApiQuery, query);
5657
jsonApiQuery = this._applyIncludes(jsonApiQuery);
5758

5859
return this._super(store, type, jsonApiQuery);
@@ -125,6 +126,13 @@ export default DS.JSONAPIAdapter.extend({
125126
return jsonApiQueryParams;
126127
},
127128

129+
_applySort(jsonApiQueryParams, rawQueryParams) {
130+
if (rawQueryParams.sort) {
131+
jsonApiQueryParams.sort = rawQueryParams.sort;
132+
}
133+
return jsonApiQueryParams;
134+
},
135+
128136
_applyIncludes(jsonApiQueryParams) {
129137
if (!isEmpty(this.include)) {
130138
jsonApiQueryParams.include = this.include.join(',');

tests/unit/adapters/ember-data-utils-jsonapi-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@ module('Unit | Adapter | ember-data-utils-jsonapi', function(hooks) {
3737
skip('with pagination');
3838
skip('with filters');
3939
skip('with includes');
40+
skip('with sort');
4041
})
4142
});

0 commit comments

Comments
 (0)