wedding-planner/app/use_cases/guests/update_use_case.rb
Manuel Bustillo bd5c4f5482
All checks were successful
Check usage of free licenses / build-static-assets (pull_request) Successful in 1m42s
Add copyright notice / copyright_notice (pull_request) Successful in 3m5s
Run unit tests / unit_tests (pull_request) Successful in 5m4s
Merge first and last name and expose guest update endpoint
2024-11-11 07:55:03 +01:00

23 lines
528 B
Ruby

# Copyright (C) 2024 Manuel Bustillo
module Guests
class UpdateUseCase
private attr_reader :guest_ids, :params
def initialize(guest_ids:, params:)
@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