Add GraphQL methods and test

Signed-off-by: Thomas Citharel <tcit@tcit.fr>

Finish

Signed-off-by: Thomas Citharel <tcit@tcit.fr>

Fix tests

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-03-14 18:31:14 +01:00
parent 98b7618338
commit 6ca0b5f915
8 changed files with 192 additions and 10 deletions

View File

@@ -3,6 +3,7 @@ defmodule MobilizonWeb.Schema.AddressType do
Schema representation for Address
"""
use Absinthe.Schema.Notation
alias MobilizonWeb.Resolvers
object :physical_address do
field(:type, :address_type)
@@ -36,4 +37,21 @@ defmodule MobilizonWeb.Schema.AddressType do
value(:phone, description: "The address is a phone number for a conference")
value(:other, description: "The address is something else")
end
object :address_queries do
@desc "Search for an address"
field :search_address, type: list_of(:physical_address) do
arg(:query, non_null(:string))
resolve(&Resolvers.Address.search/3)
end
@desc "Reverse geocode coordinates"
field :reverse_geocode, type: list_of(:physical_address) do
arg(:longitude, non_null(:float))
arg(:latitude, non_null(:float))
resolve(&Resolvers.Address.reverse_geocode/3)
end
end
end