File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
packages/cubejs-api-gateway Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,7 @@ const querySchema = Joi.object().keys({
117
117
Joi . string ( )
118
118
]
119
119
} ) ) ,
120
+ order : Joi . object ( ) . pattern ( id , Joi . valid ( 'asc' , 'desc' ) ) ,
120
121
segments : Joi . array ( ) . items ( id ) ,
121
122
timezone : Joi . string ( ) ,
122
123
limit : Joi . number ( ) . integer ( ) . min ( 1 ) . max ( 50000 )
@@ -165,10 +166,15 @@ const normalizeQuery = (query) => {
165
166
granularity : d . split ( '.' ) [ 2 ]
166
167
} ) ) ;
167
168
const timezone = query . timezone || 'UTC' ;
169
+ const order = query . order && Object . keys ( query . order ) . map ( k => ( {
170
+ id : k ,
171
+ desc : query . order [ k ] === 'desc'
172
+ } ) ) ;
168
173
return {
169
174
...query ,
170
175
rowLimit : query . rowLimit || query . limit ,
171
176
timezone,
177
+ order,
172
178
dimensions : ( query . dimensions || [ ] ) . filter ( d => d . split ( '.' ) . length !== 3 ) ,
173
179
timeDimensions : ( query . timeDimensions || [ ] ) . map ( td => {
174
180
let dateRange ;
You can’t perform that action at this time.
0 commit comments