debian-mirror-gitlab/app/finders/data_transfer/project_data_transfer_finder.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
714 B
Ruby
Raw Normal View History

2023-06-20 00:43:36 +05:30
# frozen_string_literal: true
module DataTransfer
class ProjectDataTransferFinder
def initialize(project:, from:, to:, user:)
@project = project
@from = from
@to = to
@user = user
end
def execute
return ::Projects::DataTransfer.none unless Ability.allowed?(user, :read_usage_quotas, project)
::Projects::DataTransfer
.with_project_between_dates(project, from, to)
.select(:project_id, :date, :repository_egress, :artifacts_egress, :packages_egress, :registry_egress,
"repository_egress + artifacts_egress + packages_egress + registry_egress as total_egress")
end
private
attr_reader :project, :from, :to, :user
end
end