Make Categories a predefined list
Signed-off-by: Thomas Citharel <tcit@tcit.fr> Allow null values for categories for now Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -7,7 +7,6 @@ defmodule MobilizonWeb.Schema.EventType do
|
||||
import Absinthe.Resolution.Helpers, only: [dataloader: 1]
|
||||
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
|
||||
|
||||
@@ -44,7 +43,7 @@ defmodule MobilizonWeb.Schema.EventType do
|
||||
description: "The event's tags"
|
||||
)
|
||||
|
||||
field(:category, :category, description: "The event's category")
|
||||
field(:category, :string, description: "The event's category")
|
||||
|
||||
field(:participants, list_of(:participant),
|
||||
resolve: &MobilizonWeb.Resolvers.Event.list_participants_for_event/3,
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
defmodule MobilizonWeb.Schema.Events.CategoryType do
|
||||
@moduledoc """
|
||||
Schema representation for Category
|
||||
"""
|
||||
use Absinthe.Schema.Notation
|
||||
alias MobilizonWeb.Resolvers
|
||||
|
||||
@desc "A category"
|
||||
object :category do
|
||||
field(:id, :id, description: "The category's ID")
|
||||
field(:description, :string, description: "The category's description")
|
||||
field(:picture, :picture, description: "The category's picture")
|
||||
field(:title, :string, description: "The category's title")
|
||||
end
|
||||
|
||||
object :category_queries do
|
||||
@desc "Get the list of categories"
|
||||
field :categories, non_null(list_of(:category)) do
|
||||
arg(:page, :integer, default_value: 1)
|
||||
arg(:limit, :integer, default_value: 10)
|
||||
resolve(&Resolvers.Category.list_categories/3)
|
||||
end
|
||||
end
|
||||
|
||||
object :category_mutations do
|
||||
@desc "Create a category with a title, description and picture"
|
||||
field :create_category, type: :category do
|
||||
arg(:title, non_null(:string))
|
||||
arg(:description, non_null(:string))
|
||||
arg(:picture, non_null(:upload))
|
||||
resolve(&Resolvers.Category.create_category/3)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user