Class: BulkImports::EntitiesFinder

Inherits:
Object
  • Object
show all
Defined in:
app/finders/bulk_imports/entities_finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(user:, bulk_import: nil, params: {}) ⇒ EntitiesFinder

Returns a new instance of EntitiesFinder.


5
6
7
8
9
# File 'app/finders/bulk_imports/entities_finder.rb', line 5

def initialize(user:, bulk_import: nil, params: {})
  @user = user
  @bulk_import = bulk_import
  @params = params
end

Instance Method Details

#executeObject


11
12
13
14
15
16
17
18
# File 'app/finders/bulk_imports/entities_finder.rb', line 11

def execute
  ::BulkImports::Entity
    .preload(:failures) # rubocop: disable CodeReuse/ActiveRecord
    .by_user_id(user.id)
    .then(&method(:filter_by_bulk_import))
    .then(&method(:filter_by_status))
    .then(&method(:sort))
end