#Laravel Software architecture question regarding availability classes.

6 messages · Page 1 of 1 (latest)

sick patio
#

I'm building an app that can rent a tool station at a given time per a given date.

I have a reservation table and a capacity rules table.

Reservation table/model contains all of the reservations per date and time and my capacity rules define on which dates some booking rules apply. For example some tool station is not available on some dates, or my schedule is different for some date range.

Now, my question is, how to build an efficient availability system?
I want to build a set of classes that handle, check and fetch the availability of the tool stations.

For example when the user selects 12.01.2023. 12:00 I want to check if I have some tool stations available, at what location. If not I want to find some time/dates around.

My idea is to build an AvailabilityManager Service that controls and checks availability. Also some helper classes of ToolStationAvailability that will be returned with attributes like isAvailable.

neat bloom
#

DM me and discuss more.

simple cave
# neat bloom DM me and discuss more.

This server isn't a job hunting portal if that's your intention.

The point of this help forum is to have a self-contained conversation everyone can partake in, we can't join your DMs.

Please avoid pulling people away from the server.

neat bloom
sick patio
#

More context. I'm building a SAAS for renting Tool Stations in my country.

Every tool station has it's availability.

The availability will need to be shown on the Booking Widget that can be integrated on the website.

When the guests wants to book a tool station, it will come to the website of my client and check the Tool Stand availability for a given date and time.

Now, when he submits the date/time combination, I should query the available tool stands.

#

Availability is calculated in 2 steps:

  1. we check if that tool stand is available by using the Capacity rule table

CapacityRule can be defined by exact date, date range, only some weeks, months etc. Consider this like some sort of rules that define the availability of the table for some period.
For example, some garages are not working in the winter in full capacity etc.

  1. we check if the tool stand is available by querying the Reservation table.
    the second step is more easy.

To be honest, I know how to do this, but having in mind that this is a SAAS I want to do it efficiently

Probably use some sort of service that uses Eager loading and doesn't query all the stuff on the fly

Maybe also utilising a nice Facade to check the availability
So, my idea is I implement AvailabilityManager class that will handle all of this
The availability manager will have a Garage (my client) stored in the attributes and date range. Date_from and date_to can be the same date which means we are checking for only one date.

Next, I will query the Capacity rules first to determine which capacity rule is being used for that day and extract the data from it. If that rule describes some tool stands as being available then I will query the reservation table for those tool stands
Now, what happens if we get 0 availability for that date/time, I want to query more -1 +1 date around
Which I can do by utilising the stuff I just described, but should I maybe use this AvailabilityManager as a Singleton, so it caches some of my availability data per request