Skip to content

Commit

Permalink
feat: add more sort order values (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabasJ authored Aug 28, 2023
1 parent da1d1e8 commit bce89e9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions lib/api/api.ex
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,40 @@ defmodule AshGraphql.Api do
name: "DESC",
value: :desc
},
%Absinthe.Blueprint.Schema.EnumValueDefinition{
module: schema,
identifier: :desc_nils_first,
__reference__: AshGraphql.Resource.ref(env),
name: "DESC_NULLS_FIRST",
value: :des_nils_first
},
%Absinthe.Blueprint.Schema.EnumValueDefinition{
module: schema,
identifier: :desc_nils_last,
__reference__: AshGraphql.Resource.ref(env),
name: "DESC_NULLS_LAST",
value: :desc_nils_last
},
%Absinthe.Blueprint.Schema.EnumValueDefinition{
module: schema,
identifier: :asc,
__reference__: AshGraphql.Resource.ref(env),
name: "ASC",
value: :asc
},
%Absinthe.Blueprint.Schema.EnumValueDefinition{
module: schema,
identifier: :asc_nils_first,
__reference__: AshGraphql.Resource.ref(env),
name: "ASC_NULLS_FIRST",
value: :asc_nils_first
},
%Absinthe.Blueprint.Schema.EnumValueDefinition{
module: schema,
identifier: :asc_nils_last,
__reference__: AshGraphql.Resource.ref(env),
name: "ASC_NULLS_LAST",
value: :asc_nils_last
}
],
identifier: :sort_order,
Expand Down
2 changes: 1 addition & 1 deletion test/paginate_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ defmodule AshGraphql.PaginateTest do
test "default_limit records are fetched" do
doc = """
query KeysetPaginatedPosts {
keysetPaginatedPosts(sort: [{field: TEXT}]) {
keysetPaginatedPosts(sort: [{field: TEXT, order: ASC_NULLS_LAST}]) {
count
startKeyset
endKeyset
Expand Down

0 comments on commit bce89e9

Please sign in to comment.