Sha256: 9f5f45fd0c36ab8cce42deabed06fb42e50e65ab5641420e3e69d41fb184b169

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

module Eco
  module API
    module UseCases
      class DefaultCases
        class DeleteCase < BaseCase

          def process
            @cases.define("delete", type: :transform) do |people, session|
              delete = session.job_group("main").new("delete", type: :delete, sets: [:core, :details, :account])
              people.each_with_index do |person|
                delete.add(person)
              end
            end

            @cases.define("delete", type: :sync) do |entries, people, session|
              delete = session.job_group("main").new("delete", type: :delete, sets: [:core, :details, :account])
              strict_search = session.config.people.strict_search? && (!options[:search]&.key?(:strict) || options.dig(:search, :strict))
              entries.each_with_index do |entry|
                if person = people.find(entry, strict: strict_search)
                  delete.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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
eco-helpers-0.8.4 lib/eco/api/usecases/default_cases/delete_case.rb
eco-helpers-0.8.3 lib/eco/api/usecases/default_cases/delete_case.rb
eco-helpers-0.8.2 lib/eco/api/usecases/default_cases/delete_case.rb