Class: Decidim::Core::CategoryList

Inherits:
Object
  • Object
show all
Includes:
NeedsApiFilterAndOrder
Defined in:
decidim-core/lib/decidim/api/functions/category_list.rb

Overview

An abstract resolver for the GraphQL category endpoints inside a participatory_space. Used in the keyword “categories”, ie:

participatoryProcesses {

categories(filter: { parentId: "1" }) {...}

}

Needs to be extended and add arguments.

This is used by ParticipatorySpaceInterface to apply filter categories searches.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from NeedsApiFilterAndOrder

#add_filter_keys, #add_order_keys

Constructor Details

#initializeCategoryList

Returns a new instance of CategoryList.


20
21
22
# File 'decidim-core/lib/decidim/api/functions/category_list.rb', line 20

def initialize
  @model_class = Decidim::Category
end

Instance Attribute Details

#model_classObject (readonly)

Returns the value of attribute model_class


18
19
20
# File 'decidim-core/lib/decidim/api/functions/category_list.rb', line 18

def model_class
  @model_class
end

Instance Method Details

#call(participatory_space, args, _ctx) ⇒ Object


24
25
26
27
28
# File 'decidim-core/lib/decidim/api/functions/category_list.rb', line 24

def call(participatory_space, args, _ctx)
  @query = participatory_space.categories
  add_filter_keys(args[:filter])
  @query
end