debian-mirror-gitlab/app/graphql/types/namespace_type.rb

43 lines
1.8 KiB
Ruby
Raw Normal View History

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-26 22:10:19 +05:30
field :id, GraphQL::ID_TYPE, null: false,
description: 'ID of the namespace'
2019-07-31 22:56:46 +05:30
2019-12-26 22:10:19 +05:30
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-07-31 22:56:46 +05:30
2019-12-26 22:10:19 +05:30
field :description, GraphQL::STRING_TYPE, null: true,
description: 'Description of the namespace'
2019-09-30 21:07:59 +05:30
markdown_field :description_html, null: true
2019-12-26 22:10:19 +05:30
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-09-04 21:01:54 +05:30
2019-12-04 20:38:33 +05:30
field :root_storage_statistics, Types::RootStorageStatisticsType,
null: true,
2019-12-26 22:10:19 +05:30
description: 'Aggregated storage statistics of the namespace. Only available for root namespaces',
2019-12-04 20:38:33 +05:30
resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchRootStorageStatisticsLoader.new(obj.id).find }
2019-12-26 22:10:19 +05:30
field :projects, Types::ProjectType.connection_type, null: false,
description: 'Projects within this namespace',
2019-09-04 21:01:54 +05:30
resolver: ::Resolvers::NamespaceProjectsResolver
2019-07-31 22:56:46 +05:30
end
end
2020-07-28 23:09:34 +05:30
Types::NamespaceType.prepend_if_ee('EE::Types::NamespaceType')