Allow tag relations + bump ecto deps
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -8,6 +8,7 @@ defmodule MobilizonWeb.Schema.EventType do
|
||||
import_types(MobilizonWeb.Schema.AddressType)
|
||||
import_types(MobilizonWeb.Schema.Events.ParticipantType)
|
||||
import_types(MobilizonWeb.Schema.Events.CategoryType)
|
||||
import_types(MobilizonWeb.Schema.TagType)
|
||||
alias MobilizonWeb.Resolvers
|
||||
|
||||
@desc "An event"
|
||||
@@ -37,7 +38,12 @@ defmodule MobilizonWeb.Schema.EventType do
|
||||
)
|
||||
|
||||
field(:attributed_to, :actor, description: "Who the event is attributed to (often a group)")
|
||||
# field(:tags, list_of(:tag))
|
||||
|
||||
field(:tags, list_of(:tag),
|
||||
resolve: &MobilizonWeb.Resolvers.Tag.list_tags_for_event/3,
|
||||
description: "The event's tags"
|
||||
)
|
||||
|
||||
field(:category, :category, description: "The event's category")
|
||||
|
||||
field(:participants, list_of(:participant),
|
||||
|
||||
30
lib/mobilizon_web/schema/tag.ex
Normal file
30
lib/mobilizon_web/schema/tag.ex
Normal file
@@ -0,0 +1,30 @@
|
||||
defmodule MobilizonWeb.Schema.TagType do
|
||||
@moduledoc """
|
||||
Schema representation for Tags
|
||||
"""
|
||||
use Absinthe.Schema.Notation
|
||||
alias MobilizonWeb.Resolvers
|
||||
|
||||
@desc "A tag"
|
||||
object :tag do
|
||||
field(:id, :id, description: "The tag's ID")
|
||||
field(:slug, :string, description: "The tags's slug")
|
||||
field(:title, :string, description: "The tag's title")
|
||||
|
||||
field(
|
||||
:related,
|
||||
list_of(:tag),
|
||||
resolve: &Resolvers.Tag.get_related_tags/3,
|
||||
description: "Related tags to this tag"
|
||||
)
|
||||
end
|
||||
|
||||
object :tag_queries do
|
||||
@desc "Get the list of tags"
|
||||
field :tags, non_null(list_of(:tag)) do
|
||||
arg(:page, :integer, default_value: 1)
|
||||
arg(:limit, :integer, default_value: 10)
|
||||
resolve(&Resolvers.Tag.list_tags/3)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user