summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-18 21:06:34 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-18 21:06:34 +0000
commite4c711546c693fff89b0b1c92f1b0dde927e0c84 (patch)
tree2afa79ebbb72960fd54f1392e0a18031a1d9ee54 /app/finders
parentb08279013423a66f06f5edde4e067f328fe135bd (diff)
downloadgitlab-ce-e4c711546c693fff89b0b1c92f1b0dde927e0c84.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/artifacts_finder.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/finders/artifacts_finder.rb b/app/finders/artifacts_finder.rb
new file mode 100644
index 00000000000..81c5168d782
--- /dev/null
+++ b/app/finders/artifacts_finder.rb
@@ -0,0 +1,24 @@
+# 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