Class: NotificationWorkers::Partner::ReviewBookingWorker

Inherits:
ApplicationWorker show all
Includes:
RollbarSynTokenSetterWorker
Defined in:
app/workers/notification_workers/partner/review_booking_worker.rb

Instance Method Summary collapse

Methods inherited from ApplicationWorker

unlimited_retry

Instance Method Details

#perform(review_id) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/workers/notification_workers/partner/review_booking_worker.rb', line 9

def perform(review_id)
  review = Review.find_by(id: review_id)
  return if review.blank?

  reservation = review.reservation
  return if reservation.blank?

  TransactionNotif.create(
    reservation: reservation,
    restaurant: reservation.restaurant,
    model: review,
    message_en: "Booking ##{reservation.id} wrote a review",
    message_th: "การจอง ##{reservation.id} เขียนรีวิว",
    notif_type: :review
  )
end