2020-01-26 19:34:25 +00:00
|
|
|
defmodule Mobilizon.GraphQL.Schema.Events.FeedTokenType do
|
2019-03-08 17:52:27 +00:00
|
|
|
@moduledoc """
|
2019-09-22 14:26:23 +00:00
|
|
|
Schema representation for Participant.
|
2019-03-08 17:52:27 +00:00
|
|
|
"""
|
2019-09-22 14:26:23 +00:00
|
|
|
|
2019-03-08 17:52:27 +00:00
|
|
|
use Absinthe.Schema.Notation
|
2019-09-22 14:26:23 +00:00
|
|
|
|
2019-03-08 17:52:27 +00:00
|
|
|
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
|
2019-09-22 14:26:23 +00:00
|
|
|
|
|
|
|
alias Mobilizon.{Actors, Users}
|
2020-01-26 19:34:25 +00:00
|
|
|
alias Mobilizon.GraphQL.Resolvers.FeedToken
|
2019-03-08 17:52:27 +00:00
|
|
|
|
2020-11-19 16:06:28 +00:00
|
|
|
@desc """
|
|
|
|
Represents a feed token
|
|
|
|
|
|
|
|
Feed tokens are tokens that are used to provide access to private feeds such as WebCal feed for all of your user's events,
|
|
|
|
or an Atom feed for just a profile.
|
|
|
|
"""
|
2019-03-08 17:52:27 +00:00
|
|
|
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"
|
|
|
|
)
|
|
|
|
|
2021-03-26 18:01:55 +00:00
|
|
|
field(:token, :string, description: "A ShortUUID private token")
|
2019-03-08 17:52:27 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
@desc "Represents a deleted feed_token"
|
|
|
|
object :deleted_feed_token do
|
2020-11-19 16:06:28 +00:00
|
|
|
field(:user, :deleted_object, description: "The user that owned the deleted feed token")
|
|
|
|
field(:actor, :deleted_object, description: "The actor that owned the deleted feed token")
|
2019-03-08 17:52:27 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
object :feed_token_mutations do
|
|
|
|
@desc "Create a Feed Token"
|
|
|
|
field :create_feed_token, :feed_token do
|
2020-11-19 16:06:28 +00:00
|
|
|
arg(:actor_id, :id, description: "The actor ID for the feed token")
|
2019-03-08 17:52:27 +00:00
|
|
|
|
2020-01-26 19:34:25 +00:00
|
|
|
resolve(&FeedToken.create_feed_token/3)
|
2019-03-08 17:52:27 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
@desc "Delete a feed token"
|
|
|
|
field :delete_feed_token, :deleted_feed_token do
|
2020-11-19 16:06:28 +00:00
|
|
|
arg(:token, non_null(:string), description: "The token to delete")
|
2019-03-08 17:52:27 +00:00
|
|
|
|
2020-01-26 19:34:25 +00:00
|
|
|
resolve(&FeedToken.delete_feed_token/3)
|
2019-03-08 17:52:27 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|