-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathperson_queries.ex
More file actions
32 lines (25 loc) · 869 Bytes
/
person_queries.ex
File metadata and controls
32 lines (25 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
defmodule SWAPIWeb.GraphQL.Queries.PersonQueries do
@moduledoc """
GraphQL queries for people
"""
use Absinthe.Schema.Notation
alias SWAPIWeb.GraphQL.Resolvers.PersonResolver
object :person_queries do
@desc "Get all people."
field :all_people, list_of(:person) do
resolve(&PersonResolver.all/2)
end
@desc "Get a person by ID."
field :person, :person do
@desc "The ID of the person."
arg(:id, non_null(:id))
resolve(&PersonResolver.one/2)
end
@desc "Search people by name."
field :search_people, list_of(:person) do
@desc "A list of search terms. If multiple search terms are used then objects will be returned in the list only if all the provided terms are matched."
arg(:search_terms, non_null(list_of(non_null(:string))))
resolve(&PersonResolver.search/2)
end
end
end