Introduce authorizations with Rajska
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -8,6 +8,7 @@ defmodule Mobilizon.GraphQL.Schema.StatisticsType do
|
||||
|
||||
@desc "A statistics object"
|
||||
object :statistics do
|
||||
meta(:authorize, :all)
|
||||
# Instance name
|
||||
field(:number_of_users, :integer, description: "The number of local users")
|
||||
field(:number_of_events, :integer, description: "The total number of events")
|
||||
@@ -27,6 +28,7 @@ defmodule Mobilizon.GraphQL.Schema.StatisticsType do
|
||||
end
|
||||
|
||||
object :category_statistics do
|
||||
meta(:authorize, :all)
|
||||
field(:key, :string, description: "The key for the category")
|
||||
field(:number, :integer, description: "The number of events for the given category")
|
||||
end
|
||||
@@ -34,11 +36,13 @@ defmodule Mobilizon.GraphQL.Schema.StatisticsType do
|
||||
object :statistics_queries do
|
||||
@desc "Get the instance statistics"
|
||||
field :statistics, :statistics do
|
||||
middleware(Rajska.QueryAuthorization, permit: :all)
|
||||
resolve(&Statistics.get_statistics/3)
|
||||
end
|
||||
|
||||
@desc "Get the instance's category statistics"
|
||||
field :category_statistics, list_of(:category_statistics) do
|
||||
middleware(Rajska.QueryAuthorization, permit: :all)
|
||||
resolve(&Statistics.get_category_statistics/3)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user