Sha256: 9d1c43bd8732b9589a8bb49673404acd12e509b2060cfc7a2459b377346e83d5

Contents?: true

Size: 1.39 KB

Versions: 26

Compression:

Stored size: 1.39 KB

Contents

module Eco
  module API
    class UseCases
      class DefaultCases
        class ReinviteCase < DefaultCase

          def process
            @cases.define("reinvite", type: :transform) do |people, session, options, usecase|
              invite = session.job_group("main").new("invite", usecase: usecase, type: :update, sets: :account)
              people.users.each do |person|
                person.account.send_invites = true
                invite.add(person)
              end
              invite
            end

            @cases.define("reinvite", type: :sync) do |entries, people, session, options, usecase|
              invite = session.job_group("main").new("invite", usecase: usecase, type: :update, sets: :account)

              users         = people.users
              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.account.send_invites = true
                  invite.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

26 entries across 26 versions & 1 rubygems

Version Path
eco-helpers-1.3.7 lib/eco/api/usecases/default_cases/reinvite_case.rb
eco-helpers-1.3.6 lib/eco/api/usecases/default_cases/reinvite_case.rb
eco-helpers-1.3.5 lib/eco/api/usecases/default_cases/reinvite_case.rb
eco-helpers-1.3.4 lib/eco/api/usecases/default_cases/reinvite_case.rb
eco-helpers-1.3.3 lib/eco/api/usecases/default_cases/reinvite_case.rb
eco-helpers-1.3.2 lib/eco/api/usecases/default_cases/reinvite_case.rb
eco-helpers-1.3.1 lib/eco/api/usecases/default_cases/reinvite_case.rb
eco-helpers-1.2.2 lib/eco/api/usecases/default_cases/reinvite_case.rb
eco-helpers-1.2.1 lib/eco/api/usecases/default_cases/reinvite_case.rb
eco-helpers-1.1.8 lib/eco/api/usecases/default_cases/reinvite_case.rb
eco-helpers-1.1.7 lib/eco/api/usecases/default_cases/reinvite_case.rb
eco-helpers-1.1.6 lib/eco/api/usecases/default_cases/reinvite_case.rb
eco-helpers-1.1.5 lib/eco/api/usecases/default_cases/reinvite_case.rb
eco-helpers-1.1.4 lib/eco/api/usecases/default_cases/reinvite_case.rb
eco-helpers-1.1.3 lib/eco/api/usecases/default_cases/reinvite_case.rb
eco-helpers-1.1.2 lib/eco/api/usecases/default_cases/reinvite_case.rb
eco-helpers-1.1.1 lib/eco/api/usecases/default_cases/reinvite_case.rb
eco-helpers-1.0.14 lib/eco/api/usecases/default_cases/reinvite_case.rb
eco-helpers-1.0.13 lib/eco/api/usecases/default_cases/reinvite_case.rb
eco-helpers-1.0.12 lib/eco/api/usecases/default_cases/reinvite_case.rb