1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-22 16:03:25 +00:00
mobilizon/lib/graphql/resolvers/statistics.ex
Thomas Citharel b5d9b82bdd
Refactor Mobilizon.Federation.ActivityPub and add typespecs
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2021-09-29 16:31:11 +02:00

26 lines
1.1 KiB
Elixir

defmodule Mobilizon.GraphQL.Resolvers.Statistics do
@moduledoc """
Handles the statistics-related GraphQL calls.
"""
alias Mobilizon.Service.Statistics, as: StatisticsModule
@doc """
Gets config.
"""
@spec get_statistics(any(), any(), any()) :: {:ok, map()}
def get_statistics(_parent, _params, _context) do
{:ok,
%{
number_of_users: StatisticsModule.get_cached_value(:local_users),
number_of_events: StatisticsModule.get_cached_value(:federation_events),
number_of_local_events: StatisticsModule.get_cached_value(:local_events),
number_of_comments: StatisticsModule.get_cached_value(:federation_comments),
number_of_local_comments: StatisticsModule.get_cached_value(:local_comments),
number_of_groups: StatisticsModule.get_cached_value(:federation_groups),
number_of_local_groups: StatisticsModule.get_cached_value(:local_groups),
number_of_instance_followings: StatisticsModule.get_cached_value(:instance_followings),
number_of_instance_followers: StatisticsModule.get_cached_value(:instance_followers)
}}
end
end