2021-03-08 18:12:59 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module Namespace
|
|
|
|
module PackageSettings
|
|
|
|
class Update < Mutations::BaseMutation
|
|
|
|
graphql_name 'UpdateNamespacePackageSettings'
|
|
|
|
|
2022-04-04 11:22:00 +05:30
|
|
|
include Mutations::ResolvesNamespace
|
|
|
|
|
2022-07-16 23:28:13 +05:30
|
|
|
authorize :admin_package
|
2021-03-08 18:12:59 +05:30
|
|
|
|
|
|
|
argument :namespace_path,
|
2021-10-27 15:23:28 +05:30
|
|
|
GraphQL::Types::ID,
|
2021-03-08 18:12:59 +05:30
|
|
|
required: true,
|
2021-10-27 15:23:28 +05:30
|
|
|
description: 'Namespace path where the namespace package setting is located.'
|
2021-03-08 18:12:59 +05:30
|
|
|
|
|
|
|
argument :maven_duplicates_allowed,
|
2021-10-27 15:23:28 +05:30
|
|
|
GraphQL::Types::Boolean,
|
2021-03-08 18:12:59 +05:30
|
|
|
required: false,
|
|
|
|
description: copy_field_description(Types::Namespace::PackageSettingsType, :maven_duplicates_allowed)
|
|
|
|
|
|
|
|
argument :maven_duplicate_exception_regex,
|
|
|
|
Types::UntrustedRegexp,
|
|
|
|
required: false,
|
|
|
|
description: copy_field_description(Types::Namespace::PackageSettingsType, :maven_duplicate_exception_regex)
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
argument :generic_duplicates_allowed,
|
2021-10-27 15:23:28 +05:30
|
|
|
GraphQL::Types::Boolean,
|
2021-06-08 01:23:25 +05:30
|
|
|
required: false,
|
|
|
|
description: copy_field_description(Types::Namespace::PackageSettingsType, :generic_duplicates_allowed)
|
|
|
|
|
|
|
|
argument :generic_duplicate_exception_regex,
|
|
|
|
Types::UntrustedRegexp,
|
|
|
|
required: false,
|
|
|
|
description: copy_field_description(Types::Namespace::PackageSettingsType, :generic_duplicate_exception_regex)
|
|
|
|
|
2022-11-25 23:54:43 +05:30
|
|
|
argument :maven_package_requests_forwarding,
|
|
|
|
GraphQL::Types::Boolean,
|
|
|
|
required: false,
|
|
|
|
description: copy_field_description(Types::Namespace::PackageSettingsType, :maven_package_requests_forwarding)
|
|
|
|
|
|
|
|
argument :npm_package_requests_forwarding,
|
|
|
|
GraphQL::Types::Boolean,
|
|
|
|
required: false,
|
|
|
|
description: copy_field_description(Types::Namespace::PackageSettingsType, :npm_package_requests_forwarding)
|
|
|
|
|
|
|
|
argument :pypi_package_requests_forwarding,
|
|
|
|
GraphQL::Types::Boolean,
|
|
|
|
required: false,
|
|
|
|
description: copy_field_description(Types::Namespace::PackageSettingsType, :pypi_package_requests_forwarding)
|
|
|
|
|
|
|
|
argument :lock_maven_package_requests_forwarding,
|
|
|
|
GraphQL::Types::Boolean,
|
|
|
|
required: false,
|
|
|
|
description: copy_field_description(Types::Namespace::PackageSettingsType, :lock_maven_package_requests_forwarding)
|
|
|
|
|
|
|
|
argument :lock_npm_package_requests_forwarding,
|
|
|
|
GraphQL::Types::Boolean,
|
|
|
|
required: false,
|
|
|
|
description: copy_field_description(Types::Namespace::PackageSettingsType, :lock_npm_package_requests_forwarding)
|
|
|
|
|
|
|
|
argument :lock_pypi_package_requests_forwarding,
|
|
|
|
GraphQL::Types::Boolean,
|
|
|
|
required: false,
|
|
|
|
description: copy_field_description(Types::Namespace::PackageSettingsType, :lock_pypi_package_requests_forwarding)
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
field :package_settings,
|
|
|
|
Types::Namespace::PackageSettingsType,
|
|
|
|
null: true,
|
2021-10-27 15:23:28 +05:30
|
|
|
description: 'Namespace package setting after mutation.'
|
2021-03-08 18:12:59 +05:30
|
|
|
|
|
|
|
def resolve(namespace_path:, **args)
|
|
|
|
namespace = authorized_find!(namespace_path: namespace_path)
|
|
|
|
|
|
|
|
result = ::Namespaces::PackageSettings::UpdateService
|
|
|
|
.new(container: namespace, current_user: current_user, params: args)
|
|
|
|
.execute
|
|
|
|
|
|
|
|
{
|
|
|
|
package_settings: result.payload[:package_settings],
|
|
|
|
errors: result.errors
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def find_object(namespace_path:)
|
|
|
|
resolve_namespace(full_path: namespace_path)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|