Skip to content

Commit 3c1c86c

Browse files
cleanup sort and add example to inputs
1 parent 1d90aba commit 3c1c86c

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

machines/list-records.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ module.exports = {
4343

4444
sort: {
4545
description: 'If specified, the rows coming back from the query will be sorted according to this dictionary.',
46-
typeclass: 'dictionary'
46+
example: [{ columnName: 'foo', direction: 1 }]
4747
},
4848

4949
schema: {
5050
description: 'An example indicating what each returned row should look like.',
5151
extendedDescription: 'This is used to determine the `columns` (i.e. projection) passed in w/ the query.',
52-
typeclass: 'array',
52+
example: [{ fieldName: 'username', type: 'string' }],
5353
required: true
5454
}
5555

@@ -99,7 +99,7 @@ module.exports = {
9999

100100
// Must be a stringified version
101101
case 'array':
102-
example[column.fieldName] = '[1,2,3]';
102+
example[column.fieldName] = '[1]';
103103
break;
104104
};
105105
});
@@ -126,8 +126,14 @@ module.exports = {
126126

127127
if(inputs.limit) query.limit = inputs.limit;
128128
if(inputs.skip) query.skip = inputs.skip;
129-
if(inputs.sort) query.sort = inputs.sort;
129+
if(inputs.sort) {
130+
query.sort = {};
130131

132+
// Parse array and turn into a WL sort criteria
133+
inputs.sort.forEach(function(sorter) {
134+
query.sort[sorter.columnName] = sorter.direction;
135+
});
136+
}
131137

132138
// WL SQL options
133139
var sqlOptions = {

0 commit comments

Comments
 (0)