2021-06-01 18:08:03 +02:00
|
|
|
defmodule Mobilizon.GraphQL.Schema.Users.ActivitySetting do
|
|
|
|
@moduledoc """
|
|
|
|
Schema representation for PushSubscription
|
|
|
|
"""
|
|
|
|
use Absinthe.Schema.Notation
|
|
|
|
alias Mobilizon.GraphQL.Resolvers.Users.ActivitySettings
|
2023-06-05 09:23:22 +02:00
|
|
|
alias Mobilizon.Users.ActivitySetting
|
2021-06-01 18:08:03 +02:00
|
|
|
|
|
|
|
object :activity_setting do
|
2023-03-17 18:10:59 +01:00
|
|
|
meta(:authorize, :user)
|
2021-06-01 18:08:03 +02:00
|
|
|
field(:key, :string)
|
|
|
|
field(:method, :string)
|
|
|
|
field(:enabled, :boolean)
|
|
|
|
field(:user, :user)
|
|
|
|
end
|
|
|
|
|
|
|
|
object :activity_setting_mutations do
|
|
|
|
field :update_activity_setting, :activity_setting do
|
|
|
|
arg(:key, non_null(:string))
|
|
|
|
arg(:method, non_null(:string))
|
|
|
|
arg(:enabled, non_null(:boolean))
|
2023-03-17 18:10:59 +01:00
|
|
|
|
|
|
|
middleware(Rajska.QueryAuthorization,
|
|
|
|
permit: :user,
|
2023-06-05 09:23:22 +02:00
|
|
|
scope: ActivitySetting,
|
|
|
|
rule: :"write:user:setting:activity",
|
|
|
|
args: %{key: :key}
|
2023-03-17 18:10:59 +01:00
|
|
|
)
|
|
|
|
|
2021-06-01 18:08:03 +02:00
|
|
|
resolve(&ActivitySettings.upsert_user_activity_setting/3)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|