Booking availability
The booking-availability slice manages the time a professional offers on an owned, unarchived schedule. It combines two sources:
- Day overrides: the explicit offer for one local date.
- A weekly template: entries for ISO weekdays (Monday is
1) that apply while weekly repetition is on.
What clients can actually book is decided later by public booking, which also subtracts appointments, past times, and its own booking window. This slice only stores and returns what is offered.
Entries depend on the booking mode
The schedule's booking mode decides the shape of every entry:
| Mode | Entry | Rule |
|---|---|---|
| Working hours | An interval with a start and an end | The end is after the start; 24:00 ends at midnight |
| Fixed slots | A start time only | The slot length comes from the schedule's fixed-slot duration |
Entries on one day cannot share a start time. An entry of the wrong shape for the current mode is rejected and nothing is saved. Times are local wall-clock times in the schedule's time zone.
Reading a date range
The owner reads availability for an inclusive range of local dates. Each date in the range is returned with the schedule's mode, its entries, and where they came from:
| Source | Meaning |
|---|---|
override | The date has an explicit day override. Its entries, possibly none, are the whole offer |
weekly | No override exists and repetition is on, so the template's entries for that weekday apply |
none | Nothing is offered |
An override always wins over the template, including an empty one. An override with no entries is how a professional closes a single date, such as one Monday in a repeating week, while other Mondays keep the template.
Saving a day
Saving a day replaces that date's entries with the submitted ones in one transaction. The request also carries a repeat count of 1 to 5. With a count above one, the same entries are written as overrides for that date and for the same weekday in each following week, up to the count. Each of those dates then has its own override and can be edited later without affecting the others.
Weekly repetition
Turning repetition on stores a new template in one transaction. The request names a source week, which must start on a Monday, a horizon of 1 to 5 weeks, and the template entries. The previous template is replaced completely.
While repetition is on, every date without an override uses the template. Editing a date inside the horizon creates or updates its override, so a later template change does not overwrite it.
Turning repetition off first freezes what was offered: for each date from the source week through the end of the horizon that has no override yet, the template's entries are copied into a new override. Repetition is then turned off. Dates the professional already saw as offered therefore stay offered, and dates after the horizon offer nothing.
Availability never cancels bookings
Saving a day, closing a date, changing the template, or turning repetition off only changes offer rows. Appointments in the affected time stay confirmed, remain visible in the owner's history, and keep occupying their time. Removing an offer only stops new bookings from being placed there.