Sha256: 965dd64a93aa3ac8773f3487c3ccf94ab9b93da51854613dae0201da098c06fc

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

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

    interfaces [
      Decidim::AuthorInterface
    ]

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

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

    field :nickname, !types.String, "User groups have no nickname" do
      resolve ->(obj, _args, _ctx) { UserGroupPresenter.new(obj).nickname }
    end

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

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

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-core-0.9.3 lib/decidim/core/api/user_group_type.rb
decidim-core-0.9.2 lib/decidim/core/api/user_group_type.rb
decidim-core-0.9.1 lib/decidim/core/api/user_group_type.rb
decidim-core-0.9.0 lib/decidim/core/api/user_group_type.rb