2019-07-31 22:56:46 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Types
|
|
|
|
class NamespaceType < BaseObject
|
|
|
|
graphql_name 'Namespace'
|
|
|
|
|
|
|
|
authorize :read_namespace
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
field :id, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions
|
2019-07-31 22:56:46 +05:30
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
field :name, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions
|
|
|
|
field :path, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions
|
|
|
|
field :full_name, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions
|
|
|
|
field :full_path, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions
|
2019-07-31 22:56:46 +05:30
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
field :description, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions
|
2019-09-30 21:07:59 +05:30
|
|
|
markdown_field :description_html, null: true
|
2019-12-04 20:38:33 +05:30
|
|
|
field :visibility, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions
|
|
|
|
field :lfs_enabled, GraphQL::BOOLEAN_TYPE, null: true, method: :lfs_enabled? # rubocop:disable Graphql/Descriptions
|
|
|
|
field :request_access_enabled, GraphQL::BOOLEAN_TYPE, null: true # rubocop:disable Graphql/Descriptions
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
field :root_storage_statistics, Types::RootStorageStatisticsType,
|
|
|
|
null: true,
|
|
|
|
description: 'The aggregated storage statistics. Only available for root namespaces',
|
|
|
|
resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchRootStorageStatisticsLoader.new(obj.id).find }
|
|
|
|
|
|
|
|
field :projects, # rubocop:disable Graphql/Descriptions
|
2019-09-04 21:01:54 +05:30
|
|
|
Types::ProjectType.connection_type,
|
|
|
|
null: false,
|
|
|
|
resolver: ::Resolvers::NamespaceProjectsResolver
|
2019-07-31 22:56:46 +05:30
|
|
|
end
|
|
|
|
end
|