mirror of
https://github.com/ash-project/ash_graphql.git
synced 2024-09-19 12:53:40 +12:00
bugfix: Fix check for checking if a field is filterable or not (#198)
This commit is contained in:
parent
36eac7bc54
commit
3e5cf20023
2 changed files with 4 additions and 2 deletions
|
@ -190,9 +190,9 @@ defmodule AshGraphql.Resource.Info do
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc "May the specified field be filtered on?"
|
@doc "May the specified field be filtered on?"
|
||||||
def filterable_field?(resource, field) do
|
def filterable_field?(resource, field_name) do
|
||||||
filterable_fields = AshGraphql.Resource.Info.filterable_fields(resource)
|
filterable_fields = AshGraphql.Resource.Info.filterable_fields(resource)
|
||||||
|
|
||||||
is_nil(filterable_fields) or field.name in filterable_fields
|
is_nil(filterable_fields) or field_name in filterable_fields
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,6 +9,8 @@ defmodule AshGraphql.Test.Tag do
|
||||||
graphql do
|
graphql do
|
||||||
type(:tag)
|
type(:tag)
|
||||||
|
|
||||||
|
filterable_fields [:name]
|
||||||
|
|
||||||
queries do
|
queries do
|
||||||
get :get_tag, :read
|
get :get_tag, :read
|
||||||
list :get_tags, :read
|
list :get_tags, :read
|
||||||
|
|
Loading…
Reference in a new issue