2019-07-31 22:56:46 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Types
|
|
|
|
class GroupType < NamespaceType
|
|
|
|
graphql_name 'Group'
|
|
|
|
|
|
|
|
authorize :read_group
|
|
|
|
|
|
|
|
expose_permissions Types::PermissionTypes::Group
|
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
field :web_url, GraphQL::STRING_TYPE, null: false
|
2019-07-31 22:56:46 +05:30
|
|
|
|
|
|
|
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?
|
2019-09-04 21:01:54 +05:30
|
|
|
field :parent, GroupType,
|
|
|
|
null: true,
|
|
|
|
resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Group, obj.parent_id).find }
|
2019-07-31 22:56:46 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|