Sha256: 5d02b969be9f5c82d079482a2e62d5ec789f58df764d84552073f8eff79b6dfd

Contents?: true

Size: 704 Bytes

Versions: 50

Compression:

Stored size: 704 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Surveys
    class SurveysType < Decidim::Api::Types::BaseObject
      implements Decidim::Core::ComponentInterface

      graphql_name "Surveys"
      description "A surveys component of a participatory space."

      field :surveys, Decidim::Surveys::SurveyType.connection_type, null: true, connection: true

      def surveys
        Survey.where(component: object).includes(:component)
      end

      field :survey, Decidim::Surveys::SurveyType, null: true do
        argument :id, GraphQL::Types::ID, required: true
      end

      def survey(**args)
        Survey.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-surveys-0.29.1 lib/decidim/api/surveys_type.rb
decidim-surveys-0.28.4 lib/decidim/api/surveys_type.rb
decidim-surveys-0.27.9 lib/decidim/api/surveys_type.rb
decidim-surveys-0.29.0 lib/decidim/api/surveys_type.rb
decidim-surveys-0.28.3 lib/decidim/api/surveys_type.rb
decidim-surveys-0.27.8 lib/decidim/api/surveys_type.rb
decidim-surveys-0.29.0.rc4 lib/decidim/api/surveys_type.rb
decidim-surveys-0.29.0.rc3 lib/decidim/api/surveys_type.rb
decidim-surveys-0.29.0.rc2 lib/decidim/api/surveys_type.rb
decidim-surveys-0.29.0.rc1 lib/decidim/api/surveys_type.rb
decidim-surveys-0.28.2 lib/decidim/api/surveys_type.rb
decidim-surveys-0.27.7 lib/decidim/api/surveys_type.rb
decidim-surveys-0.28.1 lib/decidim/api/surveys_type.rb
decidim-surveys-0.27.6 lib/decidim/api/surveys_type.rb
decidim-surveys-0.26.10 lib/decidim/api/surveys_type.rb
decidim-surveys-0.26.9 lib/decidim/api/surveys_type.rb
decidim-surveys-0.28.0 lib/decidim/api/surveys_type.rb
decidim-surveys-0.27.5 lib/decidim/api/surveys_type.rb
decidim-surveys-0.28.0.rc5 lib/decidim/api/surveys_type.rb
decidim-surveys-0.28.0.rc4 lib/decidim/api/surveys_type.rb