1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-26 09:49:12 +00:00
mobilizon/lib/graphql/schema/users/activity_setting.ex
Thomas Citharel 6c1e1e98d8
fix(activity settings): fix saving activity settings
Closes #1251

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2023-06-05 09:23:22 +02:00

33 lines
905 B
Elixir

defmodule Mobilizon.GraphQL.Schema.Users.ActivitySetting do
@moduledoc """
Schema representation for PushSubscription
"""
use Absinthe.Schema.Notation
alias Mobilizon.GraphQL.Resolvers.Users.ActivitySettings
alias Mobilizon.Users.ActivitySetting
object :activity_setting do
meta(:authorize, :user)
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))
middleware(Rajska.QueryAuthorization,
permit: :user,
scope: ActivitySetting,
rule: :"write:user:setting:activity",
args: %{key: :key}
)
resolve(&ActivitySettings.upsert_user_activity_setting/3)
end
end
end