Class: Eco::API::UseCases::DefaultCases::RestoreDBCase
- Inherits:
-
Common::Loaders::UseCase
- Object
- Common::BaseLoader
- Common::Loaders::UseCase
- Eco::API::UseCases::DefaultCases::RestoreDBCase
- Defined in:
- lib/eco/api/usecases/default_cases/restore_db_case.rb
Instance Method Summary collapse
Methods inherited from Common::Loaders::UseCase
Methods inherited from Common::BaseLoader
<=>, created_at, #initialize, #name, name_only_once!, set_created_at!
Methods included from Common::ClassHelpers
#class_resolver, #descendants, #descendants?, #new_class, #resolve_class, #to_constant
Constructor Details
This class inherits a constructor from Eco::API::Common::Loaders::UseCase
Instance Method Details
#main(entries, people, session, options, usecase) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/eco/api/usecases/default_cases/restore_db_case.rb', line 5 def main(entries, people, session, , usecase) micro = session.micro require_people_as_entries!(entries) restart = session.new_job("main", "restart", :create, usecase) if .dig(:include, :create) update = session.new_job("main", "update", :update, usecase) delete = session.new_job("main", "delete", :update, usecase) if .dig(:include, :delete) micro.with_each_leaver(entries, people, ) do |person| delete.add(person) end end re_starters = [] micro.with_each(entries, people, ) do |entry, person| if person.new? && !.dig(:include, :create) re_starters.push(entry); next end person.new? ? restart.add(person) : update.add(person) core_copy(entry, person, ) unless .dig(:exclude, :core) person.details = entry.details unless .dig(:exclude, :details) unless .dig(:exclude, :account) || !entry.account person.account ||= {} account_copy(entry.account, person.account, ) end end report_re_starters(re_starters, session.logger) end |