My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Choosing how to design a booking system/availability calendar

Brett Crowe's photo
Brett Crowe
·Mar 22, 2017

I’m adding an appointment booking system to an existing rails app. In planning this out I see two distinct but connected pieces:

1) The booking system itself where a user can select from available times to book another user; and

2) An availability settings/calendar page where bookable users, whose availability defaults to always available, can set parameters limiting that availability i.e. ‘unavailable on weekends’.

In attempting to tackle the first piece of this project I’ve run into 3 pain points

a) Displaying a list of available appointment times as a list of times rather than single datetime select fields - i.e. this style of setup from youcanbook.me - and ensuring that times that have already been booked don’t show up.

b) Backend validation of no appointments overlap in case users book an appointment at the same time.

c) Allowing for timezone/daylight savings variance across users.

I need to solve point a) before I worry about anything else and I’d really appreciate some more complete advice on this issue. I’ve seen some examples where people suggest setting up a time slots model in the database that has_many bookings. I’ve also seen others simply display a table of possible times with hidden radio buttons and link the selection to a datetime select field in the booking model.

In either case I’m not sure how I would block off/not display unavailable or already booked times in this new appointment form view. Does anyone have any thoughts on how best to set up even that initial form in the view to select dates? Or more generally on how to design the database schema for this type of system? Any thoughts/examples would be much appreciated!