I am working on a personal project the deals with bookings.
I currently hit a wall on how to get my booking system done. Basically my idea is to allow a shop to register their services with us and a user can book that service. For example, a barber shop, might have different haircuts and services and each of them has a duration. for example, he might list, three services.
Service 1: duration: 30 mins
service 2 duration: 15 mins
service 3 : duration : 60 mins/1hr
Now, problem with this I need a way to create an availability slot for each shop and each shop they have their own opening hours and closing hours.
So that when the user wants to book a service, first he has to check an availability by showing him the calandar.
I am using react native and node.js by the way.
How should I go on by implementing this.
Should, prepopulate each user availablity schema with time slots and then when ever the user wants to book we can reterive these dates and show him the available slots.
if this a good way , how should I go on implementing this.
the other idea that I have is to allow the shop owner to login to their dashboard and give the system a range of dates where users can book. For example, if he selected from 1/1/2020 - 1/12/2020 we can take this date and populate his calandar with dates and slots.
I know this a very complicated process so if someone can give me the starting point or an idea that would be perfect.
What if a user wants an oddball booking time? (“I need my appointment to start at 8:07. It’s an hour long.”)
How does each service handle overlaps?
Take your barber shop - if they have 4 barbers, but your system only allows 1 person to be booked at a given time slot, you’ve got 3 barbers sitting around doing nothing…
No, each barber can list multiple services and each service would have a duration. For example, barber one, might have the following servicers, hair cut: duration: 15 mins, the next one is 30 mins.
Presume, as shop owner would have multiple services that the user can book from and assume that the barber opens 9 and close at 5. and his default time slots art, 9:00 to 9:30 , 9:30 to 10:00 etc.
my concern should I store these slots as prepopulated, like when shop owner sign to his dashboard he can just fill calandar for each date.
or how should I do this. The overlap thing can be handled by checking the for a particular date and particular time.
For exmaple, as a user, I want this time slots of 9:00 to 9:30 , so the system is going to check this time slots.
I can manage the overlaping part by only concern is how to figure out the calandar part of this app.
And your point of having multiple barbers is very good point to be honest. but if someone book he can choose form the list of barbers in that shop and they will be disabled, so if the next person comes and wants, he can see 3 barbers and each slot that is available.
I dont mind handling this part later, my only concern is just to get it started. Even with one barber I dont mind. Step by step.
That’s a design decision. Noone’s going to be able to tell you ‘you must do this’. They could be prepopulated, they could be freeform. It’s up to you to decide what you want to do.
My first suggestion will be to treat all your dates and times as timestamps. That way you can do some basic arithmetic with them.
Well, we need to understand the concept of ‘slot’. A slot is a span of time, with some length X, and some start time Y.
X can be defined as a positive integer; (if your clients REALLY get to the point of booking things by the half-minute or by-the-second… run.)
Y is a time, so falls in the range 00:00 to 23:59.
Behind the scenes, I would redefine X and Y as:
X: The number of seconds in the slot,
Y: The timestamp of the slot’s start point.
Thus, the end point of the slot is as simple as Y+X. (I will absolve the responsibility of leap-seconds to the gods of timestamp.)
So you figured out your boundaries for Y, and you know your X. Where can you take a booking?
Y, for your new booking, cannot be:
Before OpeningTime.
After ClosingTime-X.
Be such that for any Other appointment start times and durations (O,D), O-X < Y < O+D is True.