20 lines
405 B
Ruby
20 lines
405 B
Ruby
module UserManager
|
|
class CreateInvitations < UserManagerService
|
|
def initialize(user:, amount:, notify: true)
|
|
@user = user
|
|
@amount = amount
|
|
@notify = notify
|
|
end
|
|
|
|
def call
|
|
@amount.times do
|
|
Invitation.create(user: @user)
|
|
end
|
|
|
|
if @notify
|
|
NotificationMailer.with(user: @user).new_invitations_available.deliver_later
|
|
end
|
|
end
|
|
end
|
|
end
|