Skip to content

Commit

Permalink
More IDE-friendly way of switch-case events by type
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejkrzywda committed Oct 1, 2024
1 parent 9df0c40 commit 8cd551e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ecommerce/processes/lib/processes/reservation_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ def initialize

def call(event)
state = build_state(event)
case event.event_type
when 'Ordering::OrderSubmitted'
case event
when Ordering::OrderSubmitted
update_order_state(state) { reserve_stock(state) }
when 'Fulfillment::OrderCancelled'
when Fulfillment::OrderCancelled
release_stock(state)
when 'Fulfillment::OrderConfirmed'
when Fulfillment::OrderConfirmed
dispatch_stock(state)
end
end
Expand Down

0 comments on commit 8cd551e

Please sign in to comment.