Making a single reservation, blocking all other requests
We are developing a system, that allows to make a reservation of an item for an offer. In an early phase, the item can be reserved by many offers. Thats not the problem. But at a later step in the process, an offer should be making a blocking reservation of this item.
I planned to do it like this:
1) allow several orders to make a reference to the item
2) as long as the item is not blocked, one offer should be able to block this item (item references to order - but it should only be one relation allowed)
3) only a change in the order may reset the blocking status and allow other orders to block this item
So I need to be able to:
a) automatically set a link from the item to the order, that caused the block
b) only allow further changes, if they are caused by the linked order
How can I do a) and b) ? I will also further investigate and keep this question updated.
I would set up a relationship that allows for many offers for a reservation, and a second relationship that is the other way round so that only one offer can block the reservation.
Then use a combination of triggers and writable ifs to set and re-set accordingly.
Let me know if you need more help.