Sha256: 9598942fec1618862399a2145eb91834cfbdb28250314291718f7c8dd65c35ea

Contents?: true

Size: 703 Bytes

Versions: 50

Compression:

Stored size: 703 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Budgets
    class BudgetsType < Decidim::Api::Types::BaseObject
      implements Decidim::Core::ComponentInterface

      graphql_name "Budgets"
      description "A budget component of a participatory space."

      field :budgets, Decidim::Budgets::BudgetType.connection_type, null: true, connection: true

      def budgets
        Budget.where(component: object).includes(:component)
      end

      field :budget, Decidim::Budgets::BudgetType, null: true do
        argument :id, GraphQL::Types::ID, required: true
      end

      def budget(**args)
        Budget.where(component: object).find_by(id: args[:id])
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
decidim-budgets-0.26.8 lib/decidim/api/budgets_type.rb
decidim-budgets-0.27.4 lib/decidim/api/budgets_type.rb
decidim-budgets-0.27.3 lib/decidim/api/budgets_type.rb
decidim-budgets-0.26.7 lib/decidim/api/budgets_type.rb
decidim-budgets-0.26.5 lib/decidim/api/budgets_type.rb
decidim-budgets-0.27.2 lib/decidim/api/budgets_type.rb
decidim-budgets-0.27.1 lib/decidim/api/budgets_type.rb
decidim-budgets-0.26.4 lib/decidim/api/budgets_type.rb
decidim-budgets-0.27.0 lib/decidim/api/budgets_type.rb
decidim-budgets-0.26.3 lib/decidim/api/budgets_type.rb
decidim-budgets-0.27.0.rc2 lib/decidim/api/budgets_type.rb
decidim-budgets-0.27.0.rc1 lib/decidim/api/budgets_type.rb
decidim-budgets-0.26.2 lib/decidim/api/budgets_type.rb
decidim-budgets-0.26.1 lib/decidim/api/budgets_type.rb
decidim-budgets-0.26.0 lib/decidim/api/budgets_type.rb
decidim-budgets-0.26.0.rc2 lib/decidim/api/budgets_type.rb
decidim-budgets-0.26.0.rc1 lib/decidim/api/budgets_type.rb
decidim-budgets-0.25.2 lib/decidim/api/budgets_type.rb
decidim-budgets-0.25.1 lib/decidim/api/budgets_type.rb
decidim-budgets-0.25.0 lib/decidim/api/budgets_type.rb