2019-01-14 17:13:17 +01:00
|
|
|
defmodule MobilizonWeb.Schema.CommentType do
|
2019-01-14 17:48:08 +01:00
|
|
|
@moduledoc """
|
|
|
|
Schema representation for Comment
|
|
|
|
"""
|
2019-01-14 17:13:17 +01:00
|
|
|
use Absinthe.Schema.Notation
|
2019-01-25 15:41:10 +01:00
|
|
|
alias MobilizonWeb.Resolvers.Comment
|
2019-01-14 17:13:17 +01:00
|
|
|
|
|
|
|
@desc "A comment"
|
|
|
|
object :comment do
|
2019-01-21 15:08:22 +01:00
|
|
|
field(:id, :id, description: "Internal ID for this comment")
|
2019-01-14 17:13:17 +01:00
|
|
|
field(:uuid, :uuid)
|
|
|
|
field(:url, :string)
|
|
|
|
field(:local, :boolean)
|
2019-01-14 17:48:08 +01:00
|
|
|
field(:visibility, :comment_visibility)
|
2019-01-14 17:13:17 +01:00
|
|
|
field(:text, :string)
|
|
|
|
field(:primaryLanguage, :string)
|
|
|
|
field(:replies, list_of(:comment))
|
|
|
|
field(:threadLanguages, non_null(list_of(:string)))
|
|
|
|
end
|
2019-01-14 17:48:08 +01:00
|
|
|
|
|
|
|
@desc "The list of visibility options for a comment"
|
|
|
|
enum :comment_visibility do
|
2019-09-16 15:11:43 +02:00
|
|
|
value(:public, description: "Publicly listed and federated. Can be shared.")
|
2019-01-14 17:48:08 +01:00
|
|
|
value(:unlisted, description: "Visible only to people with the link - or invited")
|
|
|
|
|
|
|
|
value(:private,
|
|
|
|
description: "Visible only to people members of the group or followers of the person"
|
|
|
|
)
|
|
|
|
|
|
|
|
value(:moderated, description: "Visible only after a moderator accepted")
|
|
|
|
value(:invite, description: "visible only to people invited")
|
|
|
|
end
|
2019-01-25 15:41:10 +01:00
|
|
|
|
|
|
|
object :comment_mutations do
|
|
|
|
@desc "Create a comment"
|
|
|
|
field :create_comment, type: :comment do
|
|
|
|
arg(:text, non_null(:string))
|
|
|
|
arg(:actor_username, non_null(:string))
|
|
|
|
|
|
|
|
resolve(&Comment.create_comment/3)
|
|
|
|
end
|
|
|
|
end
|
2019-01-14 17:13:17 +01:00
|
|
|
end
|