Add user setting to provide location and show events near location on

homepage

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-02-12 18:19:49 +01:00
parent 7d8399f4c8
commit b1cc3868a6
27 changed files with 538 additions and 112 deletions

View File

@@ -177,6 +177,10 @@ defmodule Mobilizon.GraphQL.Schema.UserType do
description:
"When does the user receives a notification about a new pending membership in one of the group they're admin for"
)
field(:location, :location,
description: "The user's preferred location, where they want to be suggested events"
)
end
@desc "The list of values the for pending notification settings"
@@ -199,6 +203,25 @@ defmodule Mobilizon.GraphQL.Schema.UserType do
)
end
object :location do
field(:range, :integer, description: "The range in kilometers the user wants to see events")
field(:geohash, :string, description: "A geohash representing the user's preferred location")
field(:name, :string, description: "A string describing the user's preferred location")
end
@desc """
The set of parameters needed to input a location
"""
input_object :location_input do
field(:range, :integer, description: "The range in kilometers the user wants to see events")
field(:geohash, :string, description: "A geohash representing the user's preferred location")
field(:name, :string, description: "A string describing the user's preferred location")
end
object :user_queries do
@desc "Get an user"
field :user, :user do
@@ -343,6 +366,10 @@ defmodule Mobilizon.GraphQL.Schema.UserType do
"When does the user receives a notification about a new pending membership in one of the group they're admin for"
)
arg(:location, :location_input,
description: "A geohash of the user's preferred location, where they want to see events"
)
resolve(&User.set_user_setting/3)
end