Sha256: 0202dc8e9a1cf517662b3ecbaee59e7f78d46850ee85bb624bcf91d5dc60c849

Contents?: true

Size: 1.6 KB

Versions: 9

Compression:

Stored size: 1.6 KB

Contents

# frozen_string_literal: true

module Decidim
  module Core
    # This type represents a UserGroup
    UserGroupType = GraphQL::ObjectType.define do
      name "UserGroup"
      description "A user group"

      interfaces [
        -> { Decidim::Core::AuthorInterface }
      ]

      field :id, !types.ID, "The user group's id"

      field :name, !types.String, "The user group's name"

      field :nickname, !types.String, "The user group nickname" do
        resolve ->(group, _args, _ctx) { group.presenter.nickname }
      end

      field :avatarUrl, !types.String, "The user's avatar url" do
        resolve ->(group, _args, _ctx) { group.presenter.avatar_url }
      end

      field :profilePath, !types.String, "The user group's profile url" do
        resolve ->(group, _args, _ctx) { group.presenter.profile_path }
      end

      field :organizationName, !types.String, "The user group's organization name" do
        resolve ->(group, _args, _ctx) { group.organization.name }
      end

      field :deleted, !types.Boolean, "Whether the user group's has been deleted or not" do
        resolve ->(group, _args, _ctx) { group.presenter.deleted? }
      end

      field :badge, !types.String, "A badge for the user group" do
        resolve ->(group, _args, _ctx) { group.presenter.badge }
      end

      field :members, !types[UserType], "Members of this group" do
        resolve ->(group, _args, _ctx) { group.accepted_users }
      end

      field :membersCount, !types.Int, "Number of members in this group" do
        resolve ->(group, _args, _ctx) { group.accepted_memberships.count }
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
decidim-core-0.23.6 app/types/decidim/core/user_group_type.rb
decidim-core-0.23.5 app/types/decidim/core/user_group_type.rb
decidim-core-0.23.4 app/types/decidim/core/user_group_type.rb
decidim-core-0.23.3 app/types/decidim/core/user_group_type.rb
decidim-core-0.23.2 app/types/decidim/core/user_group_type.rb
decidim-core-0.23.1 app/types/decidim/core/user_group_type.rb
decidim-core-0.23.1.rc1 app/types/decidim/core/user_group_type.rb
decidim-core-0.23.0 app/types/decidim/core/user_group_type.rb
decidim-core-0.22.0 app/types/decidim/core/user_group_type.rb