Sha256: 66a02271ef7d20f31bf61511f63bedd91fb578e6f7a81b434e058d48a0a3b69e

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

module Decidim
  module Proposals
    ProposalType = GraphQL::ObjectType.define do
      name "Proposal"
      description "A proposal"

      field :id, !types.ID
      field :title, !types.String, "This proposal's title"
      field :body, types.String, "This proposal's body"
      field :state, types.String, "The state in which proposal is in"
      field :address, types.String, "The physical address (location) of this proposal"

      field :publishedAt, Decidim::Core::DateTimeType do
        description "The date and time this proposal was published"
        property :published_at
      end

      field :endorsementsCount, types.Int do
        description "The total amount of endorsements the proposal has received"
        property :proposal_endorsements_count
      end

      field :voteCount, types.Int do
        description "The total amount of votes the proposal has received"
        resolve ->(proposal, _args, _ctx) {
          current_feature = proposal.feature
          proposal.proposal_votes_count unless current_feature.current_settings.votes_hidden?
        }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decidim-proposals-0.10.1 app/types/decidim/proposals/proposal_type.rb
decidim-proposals-0.10.0 app/types/decidim/proposals/proposal_type.rb