Sha256: 1f0b6c5ffd945e6d1202dcb482c9451bd8e5ff72577c2bc42ba37ad59c29ab2b

Contents?: true

Size: 1.33 KB

Versions: 38

Compression:

Stored size: 1.33 KB

Contents

# frozen_string_literal: true

module Decidim
  module Elections
    # This type represents an answer to an election question.
    # The name is different from the model because to enforce consistency with Question type name.
    class ElectionAnswerType < Decidim::Api::Types::BaseObject
      implements Decidim::Core::AttachableInterface
      implements Decidim::Core::TraceableInterface

      description "An answer for an election's question"

      field :id, GraphQL::Types::ID, "The internal ID of this answer", null: false
      field :title, Decidim::Core::TranslatedFieldType, "The title for this answer", null: false
      field :description, Decidim::Core::TranslatedFieldType, "The description for this answer", null: true
      field :weight, GraphQL::Types::Int, "The ordering weight for this answer", null: true
      field :results_total, GraphQL::Types::Int, "The total sum of votes for this answer", null: true, camelize: false
      field :selected, GraphQL::Types::Boolean, "Is this answer selected?", null: true

      field :proposals, [Decidim::Proposals::ProposalType, { null: true }], "The proposals related to this answer", null: true if defined?(Decidim::Proposals::ProposalType)
      field :results, [Decidim::Elections::ElectionResultType, { null: true }], "The voting results related to this answer", null: true
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
decidim-elections-0.28.4 lib/decidim/api/election_answer_type.rb
decidim-elections-0.27.9 lib/decidim/api/election_answer_type.rb
decidim-elections-0.28.3 lib/decidim/api/election_answer_type.rb
decidim-elections-0.27.8 lib/decidim/api/election_answer_type.rb
decidim-elections-0.28.2 lib/decidim/api/election_answer_type.rb
decidim-elections-0.27.7 lib/decidim/api/election_answer_type.rb
decidim-elections-0.28.1 lib/decidim/api/election_answer_type.rb
decidim-elections-0.27.6 lib/decidim/api/election_answer_type.rb
decidim-elections-0.26.10 lib/decidim/api/election_answer_type.rb
decidim-elections-0.26.9 lib/decidim/api/election_answer_type.rb
decidim-elections-0.28.0 lib/decidim/api/election_answer_type.rb
decidim-elections-0.27.5 lib/decidim/api/election_answer_type.rb
decidim-elections-0.28.0.rc5 lib/decidim/api/election_answer_type.rb
decidim-elections-0.28.0.rc4 lib/decidim/api/election_answer_type.rb
decidim-elections-0.26.8 lib/decidim/api/election_answer_type.rb
decidim-elections-0.27.4 lib/decidim/api/election_answer_type.rb
decidim-elections-0.27.3 lib/decidim/api/election_answer_type.rb
decidim-elections-0.26.7 lib/decidim/api/election_answer_type.rb
decidim-elections-0.26.5 lib/decidim/api/election_answer_type.rb
decidim-elections-0.27.2 lib/decidim/api/election_answer_type.rb