i have this situation : I am trying to do an excercise about the prenotation of a user for a cinema. A user can be only in one film at the moment, (but he can buy another ticket for the next show if he want). Every show has a start time and an end time ( so i can rapresent them with timestamp ). My question is: how can i add a controll that the user that is partecipating at one show cannot buy another ticket for another show at the same time? We can immagine a user with an unique id, and a cinema room with an Id. And a third object ( Show with an Id, startTime,EndTime). My question is not a lot about code implementation but much more about the logic.
A person can partecipate only one for a certain interval to a show.( he cannot partecipate at the same time in two different shows, cause he need to respect the startTime and the EndTime of the show). For some reason if the user try to buy another ticket for another show at the same place he cannot do it because he is suposed to follow a show at this interval.