2020-01-26 20:34:25 +01:00
|
|
|
defmodule Mobilizon.GraphQL.Schema.Events.FeedTokenType do
|
2019-03-08 18:52:27 +01:00
|
|
|
@moduledoc """
|
2019-09-22 16:26:23 +02:00
|
|
|
Schema representation for Participant.
|
2019-03-08 18:52:27 +01:00
|
|
|
"""
|
2019-09-22 16:26:23 +02:00
|
|
|
|
2019-03-08 18:52:27 +01:00
|
|
|
use Absinthe.Schema.Notation
|
2019-09-22 16:26:23 +02:00
|
|
|
|
2019-03-08 18:52:27 +01:00
|
|
|
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
|
2019-09-22 16:26:23 +02:00
|
|
|
|
|
|
|
alias Mobilizon.{Actors, Users}
|
2020-01-26 20:34:25 +01:00
|
|
|
alias Mobilizon.GraphQL.Resolvers.FeedToken
|
2019-03-08 18:52:27 +01:00
|
|
|
|
|
|
|
@desc "Represents a participant to an event"
|
|
|
|
object :feed_token do
|
|
|
|
field(
|
|
|
|
:actor,
|
|
|
|
:actor,
|
|
|
|
resolve: dataloader(Actors),
|
|
|
|
description: "The event which the actor participates in"
|
|
|
|
)
|
|
|
|
|
|
|
|
field(
|
|
|
|
:user,
|
|
|
|
:user,
|
|
|
|
resolve: dataloader(Users),
|
|
|
|
description: "The actor that participates to the event"
|
|
|
|
)
|
|
|
|
|
|
|
|
field(:token, :string, description: "The role of this actor at this event")
|
|
|
|
end
|
|
|
|
|
|
|
|
@desc "Represents a deleted feed_token"
|
|
|
|
object :deleted_feed_token do
|
|
|
|
field(:user, :deleted_object)
|
|
|
|
field(:actor, :deleted_object)
|
|
|
|
end
|
|
|
|
|
|
|
|
object :feed_token_mutations do
|
|
|
|
@desc "Create a Feed Token"
|
|
|
|
field :create_feed_token, :feed_token do
|
2019-09-09 09:31:08 +02:00
|
|
|
arg(:actor_id, :id)
|
2019-03-08 18:52:27 +01:00
|
|
|
|
2020-01-26 20:34:25 +01:00
|
|
|
resolve(&FeedToken.create_feed_token/3)
|
2019-03-08 18:52:27 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
@desc "Delete a feed token"
|
|
|
|
field :delete_feed_token, :deleted_feed_token do
|
|
|
|
arg(:token, non_null(:string))
|
|
|
|
|
2020-01-26 20:34:25 +01:00
|
|
|
resolve(&FeedToken.delete_feed_token/3)
|
2019-03-08 18:52:27 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|