18 lines
352 B
Ruby
18 lines
352 B
Ruby
class CreateInvitations < ApplicationService
|
|
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
|