For my web app i need to handle access requests. Requests are entered for a monday-sunday schedule specifying hours for each day. This week schedule can repeat up to 52 times. A user can have multiple schedules during a week (mon 8-9 and mon 10-11) There are the following requirements:
- Searchable/filterable
- Detect overlapping requests
I want the database to handle as much of the lifting as possible. Right now the only design I can think of is storing each day's access as a separate record. Doing this I would pull all accesses for a user and loop to determine if the new request overlaps. This requires code or a stored procedure.
Does anyone have a better database model idea or a clean way to deal with overlaps in code?