Migrate to Vue 3 and Vite
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -4,7 +4,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Address do
|
||||
"""
|
||||
|
||||
alias Mobilizon.Addresses.Address
|
||||
alias Mobilizon.Service.Geospatial
|
||||
alias Mobilizon.Service.{Geospatial, Pictures}
|
||||
|
||||
require Logger
|
||||
|
||||
@@ -44,7 +44,14 @@ defmodule Mobilizon.GraphQL.Resolvers.Address do
|
||||
%{longitude: longitude, latitude: latitude, zoom: zoom, locale: locale},
|
||||
_context
|
||||
) do
|
||||
addresses = Geospatial.service().geocode(longitude, latitude, lang: locale, zoom: zoom)
|
||||
addresses =
|
||||
Geospatial.service().geocode(longitude, latitude, lang: locale, zoom: zoom)
|
||||
|> Enum.map(fn address ->
|
||||
picture_info =
|
||||
Pictures.service().search(address.locality || address.region || address.country)
|
||||
|
||||
Map.put(address, :picture_info, picture_info)
|
||||
end)
|
||||
|
||||
{:ok, addresses}
|
||||
end
|
||||
|
||||
@@ -12,6 +12,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Config do
|
||||
"""
|
||||
@spec get_config(any(), map(), Absinthe.Resolution.t()) :: {:ok, map()}
|
||||
def get_config(_parent, _params, %{context: %{ip: ip}}) do
|
||||
# ip = "2a01:e0a:184:2000:1112:e19d:9779:88c8"
|
||||
geolix = Geolix.lookup(ip)
|
||||
|
||||
country_code =
|
||||
|
||||
@@ -6,7 +6,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Statistics do
|
||||
alias Mobilizon.Service.Statistics, as: StatisticsModule
|
||||
|
||||
@doc """
|
||||
Gets config.
|
||||
Gets statistics.
|
||||
"""
|
||||
@spec get_statistics(any(), any(), any()) :: {:ok, map()}
|
||||
def get_statistics(_parent, _params, _context) do
|
||||
@@ -23,4 +23,12 @@ defmodule Mobilizon.GraphQL.Resolvers.Statistics do
|
||||
number_of_instance_followers: StatisticsModule.get_cached_value(:instance_followers)
|
||||
}}
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets category statistics
|
||||
"""
|
||||
@spec get_category_statistics(any(), any(), any()) :: {:ok, list()}
|
||||
def get_category_statistics(_parent, _params, _context) do
|
||||
{:ok, StatisticsModule.category_statistics()}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -22,6 +22,7 @@ defmodule Mobilizon.GraphQL.Schema.AddressType do
|
||||
field(:id, :id, description: "The address's ID")
|
||||
field(:origin_id, :string, description: "The address's original ID from the provider")
|
||||
field(:timezone, :string, description: "The (estimated) timezone of the location")
|
||||
field(:picture_info, :picture_info, description: "A picture associated with the address")
|
||||
end
|
||||
|
||||
@desc """
|
||||
@@ -40,6 +41,20 @@ defmodule Mobilizon.GraphQL.Schema.AddressType do
|
||||
field(:info, :string)
|
||||
end
|
||||
|
||||
object :picture_info_element do
|
||||
field(:name, :string)
|
||||
field(:url, :string)
|
||||
end
|
||||
|
||||
@desc """
|
||||
A picture associated with an address
|
||||
"""
|
||||
object :picture_info do
|
||||
field(:url, :string)
|
||||
field(:author, :picture_info_element)
|
||||
field(:source, :picture_info_element)
|
||||
end
|
||||
|
||||
@desc """
|
||||
An address input
|
||||
"""
|
||||
|
||||
@@ -26,10 +26,20 @@ defmodule Mobilizon.GraphQL.Schema.StatisticsType do
|
||||
)
|
||||
end
|
||||
|
||||
object :category_statistics do
|
||||
field(:key, :string, description: "The key for the category")
|
||||
field(:number, :integer, description: "The number of events for the given category")
|
||||
end
|
||||
|
||||
object :statistics_queries do
|
||||
@desc "Get the instance statistics"
|
||||
field :statistics, :statistics do
|
||||
resolve(&Statistics.get_statistics/3)
|
||||
end
|
||||
|
||||
@desc "Get the instance's category statistics"
|
||||
field :category_statistics, list_of(:category_statistics) do
|
||||
resolve(&Statistics.get_category_statistics/3)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user