module Eco module API module UseCases class DefaultCases class NewIdCase < BaseCase def process @cases.define("new-id", type: :sync) do |entries, people, session, options, usecase| job = session.job_group("main").new("update", usecase: usecase, type: :update, sets: :core) strict_search = session.config.people.strict_search? && (!options[:search]&.key?(:strict) || options.dig(:search, :strict)) entries.each.with_index do |entry, i| if person = people.find(entry, strict: strict_search) person.external_id = entry.external_id job.add(person) else session.logger.error("Entry(#{i}) - this person does not exist: #{entry.to_s(:identify)}") end end end end end end end end end