Skip to content

Commit

Permalink
fix(graphql): searchable default sort direction (#8481)
Browse files Browse the repository at this point in the history
* fix(graphql): searchable default sort direction

* update snapshots
  • Loading branch information
sundersc authored Oct 21, 2021
1 parent 538eafc commit 12c1afa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,11 @@ $util.toJson($ListRequest)
#set( $sortField = $util.toJson(\\"\${sortItem.field}.keyword\\") )
#end
#end
#set( $sortDirection = $util.toJson({\\"order\\": $sortItem.direction}) )
#if( $util.isNullOrEmpty($sortItem.direction) )
#set( $sortDirection = $util.toJson({\\"order\\": \\"desc\\"}) )
#else
#set( $sortDirection = $util.toJson({\\"order\\": $sortItem.direction}) )
#end
$util.qr($sortValues.add(\\"{$sortField: $sortDirection}\\"))
#end
#end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ export function requestTemplate(primaryKey: string, nonKeywordFields: Expression
set(ref('sortField'), ref('util.toJson("${sortItem.field}.keyword")')),
),
),
set(ref('sortDirection'), ref('util.toJson({"order": $sortItem.direction})')),
ifElse(
ref('util.isNullOrEmpty($sortItem.direction)'),
set(ref('sortDirection'), ref('util.toJson({"order": "desc"})')),
set(ref('sortDirection'), ref('util.toJson({"order": $sortItem.direction})')),
),
qref('$sortValues.add("{$sortField: $sortDirection}")'),
]),
),
Expand Down

0 comments on commit 12c1afa

Please sign in to comment.