I'm implementing a events booking site. From the shop point of view, the seat must reduce from database only when the seat was actually booked to the customer.
My question is about concurrency. For example, suppose there is a event whose available seat quantity is 1.
If 2 users are trying to purchase the same event seat at the same time, when one of those customers has successfully payed for the seat I want the second customer not to be able to pay for the seat because the seat is already booked.
Is it possible to make such a reservation so that other customers cannot book?