Class: Eco::API::UseCases::Default::People::Amend::RestoreDBCase
- Inherits:
-
Common::Loaders::UseCase
- Object
- Common::Loaders::Base
- Common::Loaders::CaseBase
- Common::Loaders::UseCase
- Eco::API::UseCases::Default::People::Amend::RestoreDBCase
- Defined in:
- lib/eco/api/usecases/default/people/amend/restore_db_case.rb
Overview
Instance Attribute Summary
Attributes included from Language::AuxiliarLogger
Instance Method Summary collapse
-
#main(entries, people, session, options, usecase) ⇒ Object
rubocop:disable Metrics/AbcSize.
Methods inherited from Common::Loaders::UseCase
cli, cli!, #cli_apply!, #initialize, type, #type
Methods inherited from Common::Loaders::CaseBase
Methods inherited from Common::Loaders::Base
<=>, created_at, #initialize, set_created_at!
Methods included from Common::ClassHelpers
#class_resolver, #descendants, #descendants?, #inheritable_attrs, #inheritable_class_vars, #inherited, #instance_variable_name, #new_class, #resolve_class, #to_constant
Methods included from Language::AuxiliarLogger
Constructor Details
This class inherits a constructor from Eco::API::Common::Loaders::UseCase
Instance Method Details
#main(entries, people, session, options, usecase) ⇒ Object
rubocop:disable Metrics/AbcSize
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 40 |
# File 'lib/eco/api/usecases/default/people/amend/restore_db_case.rb', line 7 def main(entries, people, session, , usecase) # rubocop:disable Metrics/AbcSize 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) end |