debian-mirror-gitlab/app/finders/artifacts_finder.rb
2019-12-21 20:55:43 +05:30

24 lines
359 B
Ruby

# frozen_string_literal: true
class ArtifactsFinder
def initialize(project, params = {})
@project = project
@params = params
end
def execute
artifacts = @project.job_artifacts
sort(artifacts)
end
private
def sort_key
@params[:sort] || 'created_desc'
end
def sort(artifacts)
artifacts.order_by(sort_key)
end
end