Class: Boards::BaseItemsListService

Inherits:
BaseService show all
Includes:
ActiveRecord::ConnectionAdapters::Quoting, Gitlab::Utils::StrongMemoize
Defined in:
app/services/boards/base_items_list_service.rb

Direct Known Subclasses

Issues::ListService

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #parent

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

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

Instance Method Details

#executeObject



8
9
10
11
12
# File 'app/services/boards/base_items_list_service.rb', line 8

def execute
  items = init_collection

  order(items)
end

#metadata(required_fields = [:issue_count, :total_issue_weight]) ⇒ Object

rubocop: disable CodeReuse/ActiveRecord



15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/services/boards/base_items_list_service.rb', line 15

def (required_fields = [:issue_count, :total_issue_weight])
  fields = (required_fields)
  keys = fields.keys
  columns = fields.values_at(*keys)

  results = item_model
    .where(id: collection_ids)
    .pluck(*columns)
    .flatten

  Hash[keys.zip(results)]
end