OfficeMomsandDads/scheduler

View on GitHub
app/lib/services/notifications/needs/recipients/create.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

module Services
  module Notifications
    class Needs
      class Recipients
        class Create
          include Adamantium::Flat
          include Concord.new(:need)
          include Procto.call

          delegate :shifts,
                   :users_to_notify,
                   to: :need

          def recipients
            (users_to_notify | shifts.flat_map(&:users_to_notify)).uniq
          end
        end
      end
    end
  end
end