I am working on a food order platform and before an order can be placed I want to check if there is enough stock left of each dish.
So I need a transaction in which I can perform multiple queries to get the number of remaining dishes in stock of the dishes the customer wants to order. If there is enough stock left, the number that wants to be ordered has to be subtracted. If there is not enough stock of one dish, everything must be put back and the placing of the order must fail.
Of course this has to be done synchronously so that no 2 orders can collide with each other at the same time.
For what I could tell from the documentation, this kind of transaction is not possible at the moment, but is there anyone who has a workaround that is possible now?