diff options
Diffstat (limited to 'app/graphql/resolvers/data_transfer/project_data_transfer_resolver.rb')
-rw-r--r-- | app/graphql/resolvers/data_transfer/project_data_transfer_resolver.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/app/graphql/resolvers/data_transfer/project_data_transfer_resolver.rb b/app/graphql/resolvers/data_transfer/project_data_transfer_resolver.rb new file mode 100644 index 00000000000..c3296f7d4c3 --- /dev/null +++ b/app/graphql/resolvers/data_transfer/project_data_transfer_resolver.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +module Resolvers + module DataTransfer + class ProjectDataTransferResolver < BaseResolver + include DataTransferArguments + include Gitlab::Graphql::Authorize::AuthorizeResource + + authorizes_object! + authorize :read_usage_quotas + + type Types::DataTransfer::ProjectDataTransferType, null: false + + alias_method :project, :object + + def resolve(**args) + return { egress_nodes: [] } unless Feature.enabled?(:data_transfer_monitoring, project.group) + + results = if Feature.enabled?(:data_transfer_monitoring_mock_data, project.group) + ::DataTransfer::MockedTransferFinder.new.execute + else + ::DataTransfer::ProjectDataTransferFinder.new( + project: project, + from: args[:from], + to: args[:to], + user: current_user + ).execute + end + + { egress_nodes: results } + end + end + end +end |