Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/finders/packages/tags_finder.rb')
-rw-r--r--app/finders/packages/tags_finder.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/app/finders/packages/tags_finder.rb b/app/finders/packages/tags_finder.rb
new file mode 100644
index 00000000000..020b3d8072a
--- /dev/null
+++ b/app/finders/packages/tags_finder.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+class Packages::TagsFinder
+ attr_reader :project, :package_name, :params
+
+ delegate :find_by_name, to: :execute
+
+ def initialize(project, package_name, params = {})
+ @project = project
+ @package_name = package_name
+ @params = params
+ end
+
+ def execute
+ packages = project.packages
+ .with_name(package_name)
+ packages = packages.with_package_type(package_type) if package_type.present?
+
+ Packages::Tag.for_packages(packages)
+ end
+
+ private
+
+ def package_type
+ params[:package_type]
+ end
+end