Sha256: e9f53f0ede510c1cf565091f475a0aac6ffb319699270b6cd8c03786a7ac13fc

Contents?: true

Size: 932 Bytes

Versions: 16

Compression:

Stored size: 932 Bytes

Contents

module Eco
  module API
    module UseCases
      class DefaultCases
        class CreateDetailsCase < UseCases::BaseCase

          def process
            @cases.define("create-details", type: :sync) do |entries, people, session, options|
              creation = session.job_group("main").new("create", type: :create, sets: [:core, :details])

              entries.each.with_index do |entry, i|
                if person = people.find(entry)
                  session.logger.error("Entry(#{i}) - this person (id: '#{person.id}') already exists: #{entry.to_s(:identify)}")
                else
                  person = session.new_person
                  entry.set_core(person, exclude: "supervisor_id")
                  entry.set_details(person)

                  creation.add(person)
                end
              end
            end
          end

        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
eco-helpers-0.6.17 lib/eco/api/usecases/default_cases/create_details_case.rb
eco-helpers-0.6.16 lib/eco/api/usecases/default_cases/create_details_case.rb
eco-helpers-0.6.15 lib/eco/api/usecases/default_cases/create_details_case.rb
eco-helpers-0.6.13 lib/eco/api/usecases/default_cases/create_details_case.rb
eco-helpers-0.6.12 lib/eco/api/usecases/default_cases/create_details_case.rb
eco-helpers-0.6.11 lib/eco/api/usecases/default_cases/create_details_case.rb
eco-helpers-0.6.9 lib/eco/api/usecases/default_cases/create_details_case.rb
eco-helpers-0.6.8 lib/eco/api/usecases/default_cases/create_details_case.rb
eco-helpers-0.6.7 lib/eco/api/usecases/default_cases/create_details_case.rb
eco-helpers-0.6.6 lib/eco/api/usecases/default_cases/create_details_case.rb
eco-helpers-0.6.5 lib/eco/api/usecases/default_cases/create_details_case.rb
eco-helpers-0.6.4 lib/eco/api/usecases/default_cases/create_details_case.rb
eco-helpers-0.6.3 lib/eco/api/usecases/default_cases/create_details_case.rb
eco-helpers-0.6.2 lib/eco/api/usecases/default_cases/create_details_case.rb
eco-helpers-0.6.1 lib/eco/api/usecases/default_cases/create_details_case.rb
eco-helpers-0.6.0 lib/eco/api/usecases/default_cases/create_details_case.rb