Restart simulations whenever a guest changes their invitation status
This commit is contained in:
parent
50a5c90728
commit
35bf272ac8
@ -26,7 +26,7 @@ class GuestsController < ApplicationController
|
||||
end
|
||||
|
||||
def bulk_update
|
||||
Guest.where(id: params[:guest_ids]).update!(params.require(:properties).permit(:status))
|
||||
Guests::UpdateUseCase.new(guest_ids: params[:guest_ids], params: params.require(:properties).permit(:status)).call
|
||||
render json: {}, status: :ok
|
||||
end
|
||||
end
|
||||
|
12
app/use_cases/guests/update_use_case.rb
Normal file
12
app/use_cases/guests/update_use_case.rb
Normal file
@ -0,0 +1,12 @@
|
||||
module Guests
|
||||
class UpdateUseCase
|
||||
def initialize(guest_ids:, params:)
|
||||
Guest.where(id: guest_ids).update!(params)
|
||||
|
||||
# TODO: Not all status transitions may require a table re-arrangement
|
||||
TablesArrangement.delete_all
|
||||
|
||||
ActiveJob.perform_all_later(50.times.map { TableSimulatorJob.new })
|
||||
end
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user