Commit c0273365 authored by Sean McGivern's avatar Sean McGivern

Merge branch '296086-improve-code-readability-in-nuget-search-service' into 'master'

Improve code readability in nuget search service

See merge request gitlab-org/gitlab!50667
parents a612e32b 8121c30d
...@@ -17,8 +17,6 @@ module Packages ...@@ -17,8 +17,6 @@ module Packages
padding: 0 padding: 0
}.freeze }.freeze
RESULT = Struct.new(:results, :total_count, keyword_init: true).freeze
def initialize(current_user, project_or_group, search_term, options = {}) def initialize(current_user, project_or_group, search_term, options = {})
@current_user = current_user @current_user = current_user
@project_or_group = project_or_group @project_or_group = project_or_group
...@@ -30,7 +28,7 @@ module Packages ...@@ -30,7 +28,7 @@ module Packages
end end
def execute def execute
RESULT.new( Result.new(
total_count: non_paginated_matching_package_names.count, total_count: non_paginated_matching_package_names.count,
results: search_packages results: search_packages
) )
...@@ -152,6 +150,12 @@ module Packages ...@@ -152,6 +150,12 @@ module Packages
def per_page def per_page
[@options[:per_page], MAX_PER_PAGE].min [@options[:per_page], MAX_PER_PAGE].min
end end
class Result
include ActiveModel::Model
attr_accessor :results, :total_count
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment