...
Check that there is no other
IN_PROGRESS
device dispenses based on the same device requestFind all device dispenses related to the same device request ($.based_on)
Check that there are no records in status
IN_PROGRESS
whereinserted_at
+ configdevice_dispense_ttl
>= current date-time()in case of error - return 422 409 "Other active device dispense already exist."
...