Real-World Event Sourcing: `handle_command` for subtract doesn't make sense (pg 8)

The book implements handle_command/2 for :sub as follows:

def handle_command(%{value: val}, %{cmd: :sub, value: v}) do
  %{event_type: :value_subtracted, max(@min_state_value, val - v)
end

The value in the created event is the result expected after subtraction, i.e., it is not the subtrahend. It can be reimplemented as follows instead:

def handle_command(%{value: val}, %{cmd: :sub, value: v) do
  subtrahend = if(val >= v, do: v, else: val)
  %{event_type: :value_subtracted, value: subtrahend}
end

I’ve found the same issue, but think the code should be like:

  def handle_command(%{value: val}, %{cmd: :sub, value: v}) do
    %{event_type: :value_subtracted, value: min(val - @min_state_value, v)}
  end

In this case we can use @min_state_value correctly(not only 0)