wedding-planner/app/use_cases/guests/update_use_case.rb

23 lines
528 B
Ruby
Raw Permalink Normal View History

2024-11-03 08:31:58 +00:00
# Copyright (C) 2024 Manuel Bustillo
module Guests
class UpdateUseCase
2024-11-03 13:56:10 +01:00
private attr_reader :guest_ids, :params
def initialize(guest_ids:, params:)
2024-11-03 13:56:10 +01:00
@guest_ids = guest_ids
@params = params
end
def call
Guest.where(id: guest_ids).update!(params)
# TODO: Not all status transitions may require a table re-arrangement
return unless params.key?(:status)
TablesArrangement.delete_all
ActiveJob.perform_all_later(50.times.map { TableSimulatorJob.new })
end
end
end