2019-04-17 23:43:19 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Types
|
|
|
|
class NamespaceType < BaseObject
|
|
|
|
graphql_name 'Namespace'
|
|
|
|
|
2019-06-18 16:31:06 +00:00
|
|
|
authorize :read_namespace
|
|
|
|
|
2019-10-31 12:06:26 +00:00
|
|
|
field :id, GraphQL::ID_TYPE, null: false,
|
|
|
|
description: 'ID of the namespace'
|
2019-04-17 23:43:19 +00:00
|
|
|
|
2019-10-31 12:06:26 +00:00
|
|
|
field :name, GraphQL::STRING_TYPE, null: false,
|
|
|
|
description: 'Name of the namespace'
|
|
|
|
field :path, GraphQL::STRING_TYPE, null: false,
|
|
|
|
description: 'Path of the namespace'
|
|
|
|
field :full_name, GraphQL::STRING_TYPE, null: false,
|
|
|
|
description: 'Full name of the namespace'
|
|
|
|
field :full_path, GraphQL::ID_TYPE, null: false,
|
|
|
|
description: 'Full path of the namespace'
|
2019-04-22 19:46:13 +00:00
|
|
|
|
2019-10-31 12:06:26 +00:00
|
|
|
field :description, GraphQL::STRING_TYPE, null: true,
|
|
|
|
description: 'Description of the namespace'
|
2019-06-20 08:02:33 +00:00
|
|
|
markdown_field :description_html, null: true
|
2019-10-31 12:06:26 +00:00
|
|
|
field :visibility, GraphQL::STRING_TYPE, null: true,
|
|
|
|
description: 'Visibility of the namespace'
|
|
|
|
field :lfs_enabled, GraphQL::BOOLEAN_TYPE, null: true, method: :lfs_enabled?,
|
|
|
|
description: 'Indicates if Large File Storage (LFS) is enabled for namespace'
|
|
|
|
field :request_access_enabled, GraphQL::BOOLEAN_TYPE, null: true,
|
|
|
|
description: 'Indicates if users can request access to namespace'
|
2019-05-12 21:10:46 +00:00
|
|
|
|
2019-08-22 22:08:28 +00:00
|
|
|
field :root_storage_statistics, Types::RootStorageStatisticsType,
|
|
|
|
null: true,
|
2019-10-31 12:06:26 +00:00
|
|
|
description: 'Aggregated storage statistics of the namespace. Only available for root namespaces',
|
2019-08-22 22:08:28 +00:00
|
|
|
resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchRootStorageStatisticsLoader.new(obj.id).find }
|
|
|
|
|
2019-10-31 12:06:26 +00:00
|
|
|
field :projects, Types::ProjectType.connection_type, null: false,
|
|
|
|
description: 'Projects within this namespace',
|
2019-05-12 21:10:46 +00:00
|
|
|
resolver: ::Resolvers::NamespaceProjectsResolver
|
2019-04-17 23:43:19 +00:00
|
|
|
end
|
|
|
|
end
|
2020-07-09 12:08:56 +00:00
|
|
|
|
|
|
|
Types::NamespaceType.prepend_if_ee('EE::Types::NamespaceType')
|