Class: Boards::Issues::ListService

Inherits:
BaseService show all
Includes:
Gitlab::Utils::StrongMemoize
Defined in:
app/services/boards/issues/list_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #parent

Attributes inherited from BaseService

#current_user, #params, #project

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods inherited from BaseService

#initialize

Methods inherited from BaseService

#initialize

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

This class inherits a constructor from Boards::BaseService

Class Method Details

.valid_paramsObject


8
9
10
# File 'app/services/boards/issues/list_service.rb', line 8

def self.valid_params
  IssuesFinder.valid_params
end

Instance Method Details

#executeObject


12
13
14
15
16
# File 'app/services/boards/issues/list_service.rb', line 12

def execute
  return fetch_issues.order_closed_date_desc if list&.closed?

  fetch_issues.order_by_position_and_priority(with_cte: params[:search].present?)
end

#metadataObject

rubocop: disable CodeReuse/ActiveRecord


19
20
21
22
23
24
25
26
27
# File 'app/services/boards/issues/list_service.rb', line 19

def 
  issues = Issue.arel_table
  keys = .keys
  # TODO: eliminate need for SQL literal fragment
  columns = Arel.sql(.values_at(*keys).join(', '))
  results = Issue.where(id: fetch_issues.select(issues[:id])).pluck(columns)

  Hash[keys.zip(results.flatten)]
end