Module: Decidim::ParticipatoryProcesses::QueryExtensions
- Defined in:
- lib/decidim/participatory_processes/query_extensions.rb
Overview
This module’s job is to extend the API with custom fields related to decidim-participatory_processes.
Class Method Summary collapse
-
.included(type) ⇒ Object
Public: Extends a type with ‘decidim-participatory_processes`’s fields.
Instance Method Summary collapse
Class Method Details
.included(type) ⇒ Object
Public: Extends a type with ‘decidim-participatory_processes`’s fields.
type - A GraphQL::BaseType to extend.
Returns nothing.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/decidim/participatory_processes/query_extensions.rb', line 13 def self.included(type) type.field :participatory_process_groups, [ParticipatoryProcessGroupType], null: false, description: "Lists all participatory process groups" type.field :participatory_process_group, ParticipatoryProcessGroupType, null: true do description "Finds a participatory process group" argument :id, GraphQL::Types::ID, required: true, description: "The ID of the Participatory process group" end end |
Instance Method Details
#participatory_process_group(id:) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/decidim/participatory_processes/query_extensions.rb', line 30 def participatory_process_group(id:) Decidim::ParticipatoryProcessGroup.find_by( organization: context[:current_organization], id: id ) end |
#participatory_process_groups ⇒ Object
24 25 26 27 28 |
# File 'lib/decidim/participatory_processes/query_extensions.rb', line 24 def participatory_process_groups(*) Decidim::ParticipatoryProcessGroup.where( organization: context[:current_organization] ) end |