TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/OswalSnow/AR-Barber/llms.txt
Use this file to discover all available pages before exploring further.
Workday model stores a barber’s availability for a specific calendar date. Each record pairs a user_id with a day and records whether the barber is working that day (is_open) along with their start_time and end_time. The booking form queries these records to generate the list of available time slots for a given barber and date.
Fields
Auto-incrementing primary key.
Foreign key referencing the
users table. Identifies which barber this schedule entry belongs to.The calendar date this record applies to, stored as a
DATE column (YYYY-MM-DD). Combined with user_id, this forms a unique constraint — there can be at most one Workday record per barber per date.Indicates whether the barber is working on this date. When
false, no time slots are generated for this day regardless of what start_time and end_time contain. A barber can be marked unavailable for a holiday or day off by setting is_open = false.The time the barber starts accepting bookings, stored as a
TIME column (HH:MM:SS). Together with end_time, this drives 30-minute slot generation in the booking form. Defaults to 10:00:00.The time the barber stops accepting bookings. Slots are generated from
start_time up to (but not including) end_time in 30-minute increments. Defaults to 20:00:00.Timestamp set automatically when the record is created.
Timestamp updated automatically on every save.
Unique constraint and updateOrCreate
The workdays table enforces a unique constraint on (user_id, day). This means you cannot accidentally create two conflicting schedule records for the same barber on the same date.
The application uses updateOrCreate with this pair as the lookup key when a barber saves or updates their schedule:
Slot generation
When a customer selects a barber and date in the booking form, the application looks up the matching Workday record and generates available 30-minute slots betweenstart_time and end_time. For example, a barber with start_time = '09:00' and end_time = '13:00' produces slots at 09:00, 09:30, 10:00, 10:30, 11:00, 11:30, 12:00, and 12:30.
Slots that fall in the past (earlier than the current time on today’s date) are filtered out so customers can only book future appointments.
If no Workday record exists for a barber on a given date, that date shows no available slots in the booking form. Barbers must create a Workday record for each date they intend to work — there is no default or recurring schedule at the database level.
is_open = false behavior
Setting is_open to false blocks the day entirely, even if start_time and end_time are populated with valid times. This is useful for marking planned closures (holidays, vacations) without deleting the record.