summaryrefslogtreecommitdiff
path: root/app/finders/packages/nuget/package_finder.rb
blob: f5eb60f29316afbded0de051fea4ed0a66c9edf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

module Packages
  module Nuget
    class PackageFinder < ::Packages::GroupOrProjectPackageFinder
      MAX_PACKAGES_COUNT = 300

      def execute
        packages.limit_recent(@params[:limit] || MAX_PACKAGES_COUNT)
      end

      private

      def packages
        result = base.nuget
                     .has_version
                     .processed
                     .with_name_like(@params[:package_name])
        result = result.with_version(@params[:package_version]) if @params[:package_version].present?
        result
      end
    end
  end
end