lib/eco/api/usecases/default_cases/reinvite_case.rb in eco-helpers-1.0.5 vs lib/eco/api/usecases/default_cases/reinvite_case.rb in eco-helpers-1.0.6

- old
+ new

@@ -11,9 +11,26 @@ 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