Sha256: 795708757fea074b23cca77e6a8e4c304ba7f3372a4eeb35731ee2688c5abf76

Contents?: true

Size: 1.68 KB

Versions: 44

Compression:

Stored size: 1.68 KB

Contents

# frozen_string_literal: true

module Decidim
  module Core
    # This type represents a UserGroup
    class UserGroupType < Decidim::Api::Types::BaseObject
      description "A user group"

      implements Decidim::Core::AuthorInterface

      field :id, GraphQL::Types::ID, "The user group's id", null: false

      field :name, GraphQL::Types::String, "The user group's name", null: false

      field :nickname, GraphQL::Types::String, "The user group nickname", null: false

      def nickname
        object.presenter.nickname
      end

      field :avatar_url, GraphQL::Types::String, "The user's avatar url", null: false

      def avatar_url
        object.presenter.avatar_url
      end

      field :profile_path, GraphQL::Types::String, "The user group's profile url", null: false

      def profile_path
        object.presenter.profile_path
      end

      field :organization_name, GraphQL::Types::String, "The user group's organization name", null: false

      def organization_name
        object.organization.name
      end

      field :deleted, GraphQL::Types::Boolean, "Whether the user group's has been deleted or not", null: false

      def deleted
        object.presenter.deleted?
      end

      field :badge, GraphQL::Types::String, "A badge for the user group", null: false

      def badge
        object.presenter.badge
      end

      field :members, [Decidim::Core::UserType, { null: true }], "Members of this group", null: false

      def members
        object.accepted_users
      end

      field :members_count, GraphQL::Types::Int, "Number of members in this group", null: false

      def members_count
        object.accepted_memberships.count
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

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