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

57 lines
2.2 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
2021-10-27 15:23:28 +05:30
field :id, GraphQL::Types::ID, null: false,
2021-03-11 19:13:27 +05:30
description: 'ID of the namespace.'
2019-07-31 22:56:46 +05:30
2021-10-27 15:23:28 +05:30
field :name, GraphQL::Types::String, null: false,
2021-03-11 19:13:27 +05:30
description: 'Name of the namespace.'
2021-10-27 15:23:28 +05:30
field :path, GraphQL::Types::String, null: false,
2021-03-11 19:13:27 +05:30
description: 'Path of the namespace.'
2021-10-27 15:23:28 +05:30
field :full_name, GraphQL::Types::String, null: false,
2021-03-11 19:13:27 +05:30
description: 'Full name of the namespace.'
2021-10-27 15:23:28 +05:30
field :full_path, GraphQL::Types::ID, null: false,
2021-03-11 19:13:27 +05:30
description: 'Full path of the namespace.'
2019-07-31 22:56:46 +05:30
2021-10-27 15:23:28 +05:30
field :description, GraphQL::Types::String, null: true,
2021-03-11 19:13:27 +05:30
description: 'Description of the namespace.'
2019-09-30 21:07:59 +05:30
markdown_field :description_html, null: true
2021-02-22 17:27:13 +05:30
2021-10-27 15:23:28 +05:30
field :visibility, GraphQL::Types::String, null: true,
2021-03-11 19:13:27 +05:30
description: 'Visibility of the namespace.'
2021-10-27 15:23:28 +05:30
field :lfs_enabled, GraphQL::Types::Boolean, null: true, method: :lfs_enabled?,
2021-03-11 19:13:27 +05:30
description: 'Indicates if Large File Storage (LFS) is enabled for namespace.'
2021-10-27 15:23:28 +05:30
field :request_access_enabled, GraphQL::Types::Boolean, null: true,
2021-03-11 19:13:27 +05:30
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,
2021-03-11 19:13:27 +05:30
description: 'Aggregated storage statistics of the namespace. Only available for root namespaces.'
2019-12-04 20:38:33 +05:30
2019-12-26 22:10:19 +05:30
field :projects, Types::ProjectType.connection_type, null: false,
2021-03-11 19:13:27 +05:30
description: 'Projects within this namespace.',
2019-09-04 21:01:54 +05:30
resolver: ::Resolvers::NamespaceProjectsResolver
2021-02-22 17:27:13 +05:30
2021-03-08 18:12:59 +05:30
field :package_settings,
Types::Namespace::PackageSettingsType,
null: true,
2021-03-11 19:13:27 +05:30
description: 'The package settings for the namespace.'
2021-03-08 18:12:59 +05:30
2021-10-27 15:23:28 +05:30
field :shared_runners_setting,
Types::Namespace::SharedRunnersSettingEnum,
null: true,
description: "Shared runners availability for the namespace and its descendants."
2021-02-22 17:27:13 +05:30
def root_storage_statistics
Gitlab::Graphql::Loaders::BatchRootStorageStatisticsLoader.new(object.id).find
end
2019-07-31 22:56:46 +05:30
end
end
2020-07-28 23:09:34 +05:30
2021-06-08 01:23:25 +05:30
Types::NamespaceType.prepend_mod_with('Types::NamespaceType')