mobilizon/lib/graphql/schema/actors/member.ex

42 lines
1 KiB
Elixir
Raw Normal View History

2020-01-26 20:34:25 +01:00
defmodule Mobilizon.GraphQL.Schema.Actors.MemberType do
@moduledoc """
Schema representation for Member
"""
use Absinthe.Schema.Notation
2020-01-26 20:34:25 +01:00
alias Mobilizon.GraphQL.Resolvers.Group
2019-03-01 17:11:28 +01:00
@desc """
Represents a member of a group
"""
object :member do
field(:parent, :group, description: "Of which the profile is member")
field(:actor, :person, description: "Which profile is member of")
field(:role, :integer, description: "The role of this membership")
2019-03-01 17:11:28 +01:00
end
@desc "Represents a deleted member"
object :deleted_member do
field(:parent, :deleted_object)
field(:actor, :deleted_object)
2019-03-01 17:11:28 +01:00
end
object :member_mutations do
@desc "Join a group"
field :join_group, :member do
arg(:group_id, non_null(:id))
arg(:actor_id, non_null(:id))
2019-03-01 17:11:28 +01:00
2020-01-26 20:34:25 +01:00
resolve(&Group.join_group/3)
2019-03-01 17:11:28 +01:00
end
@desc "Leave an event"
field :leave_group, :deleted_member do
arg(:group_id, non_null(:id))
arg(:actor_id, non_null(:id))
2019-03-01 17:11:28 +01:00
2020-01-26 20:34:25 +01:00
resolve(&Group.leave_group/3)
2019-03-01 17:11:28 +01:00
end
end
end