Skip to content

Commit

Permalink
improvement: support latest ash
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Jan 19, 2024
1 parent 10d3d94 commit 67fe4d6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/graphql/resolver.ex
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ defmodule AshGraphql.Graphql.Resolver do
]

pagination = Ash.Resource.Info.action(resource, action).pagination
query = apply_load_arguments(args, Ash.Query.new(resource))
query = apply_load_arguments(args, Ash.Query.new(resource), true)

{result, modify_args} =
with {:ok, opts} <- validate_resolve_opts(resolution, pagination, opts, args),
Expand Down Expand Up @@ -2536,12 +2536,12 @@ defmodule AshGraphql.Graphql.Resolver do
child_complexity + 1
end

defp apply_load_arguments(arguments, query) do
defp apply_load_arguments(arguments, query, will_paginate? \\ false) do
Enum.reduce(arguments, query, fn
{:limit, limit}, query ->
{:limit, limit}, query when not will_paginate? ->
Ash.Query.limit(query, limit)

{:offset, offset}, query ->
{:offset, offset}, query when not will_paginate? ->
Ash.Query.offset(query, offset)

{:filter, value}, query ->
Expand Down

0 comments on commit 67fe4d6

Please sign in to comment.