summaryrefslogtreecommitdiff
path: root/app/graphql/types/group_type.rb
blob: a2d615ee732eeb36ec1d26b0176c368202903d51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

module Types
  class GroupType < NamespaceType
    graphql_name 'Group'

    authorize :read_group

    expose_permissions Types::PermissionTypes::Group

    field :web_url, GraphQL::STRING_TYPE, null: true

    field :avatar_url, GraphQL::STRING_TYPE, null: true, resolve: -> (group, args, ctx) do
      group.avatar_url(only_path: false)
    end

    if ::Group.supports_nested_objects?
      field :parent, GroupType, null: true
    end
  end
end