Skip to main content

Booking schedules

The booking-schedules slice lets an enrolled professional manage the schedules they own. A schedule is the unit that carries a public code, booking channels, a booking mode, step settings, and weekly repetition. Services, availability, and appointments all belong to one schedule.

Every operation acts on the application user resolved from the caller's Supabase session; see Authentication. A request can never name an owner. A schedule that belongs to someone else, or does not exist, gives the same not-found result, so its existence is not disclosed.

Creating a schedule​

A new schedule takes only a name. The API assigns a random public code that is unique without regard to case, and the database defaults apply: working-hours mode, both booking channels off, a 30-minute client step, a 15-minute slot step, a 30-minute fixed-slot duration, and repetition off.

Creation runs in one transaction that locks the owner and reads the professional's entitlement eligibility:

  • An owner with no entitlement record yet can always create their first schedule. Inserting it starts the one-time 30-day trial.
  • After that, creation is rejected when the count of unarchived schedules has reached the allowed count. The allowance is one schedule plus any granted extra schedules (at most 20 in total) while the trial or a paid grant is active, and zero otherwise.

A rejected creation changes nothing. The allowance counts unarchived schedules, not schedules with an open booking channel, so turning a channel on or off is not limited by it.

Configuring a schedule​

The owner can rename an unarchived schedule, open or close its browser and Telegram booking channels independently, and change its step settings:

SettingAllowed values
Client step15, 30, or 60 minutes
Slot step15, 30, or 60 minutes
Fixed-slot duration15 to 720 minutes
Repetition horizon1 to 5 weeks

The fixed-slot duration is stored on the schedule, so it is returned on every later load and on any device.

Turning weekly repetition on or off is not a schedule setting change. It goes through the availability slice's weekly-template command, which also freezes already offered dates; see Weekly repetition. A settings change that tries to switch repetition is rejected as invalid.

Changing the booking mode​

A schedule offers time either as working-hours intervals or as fixed slot start times. Because the two kinds of availability are incompatible, a mode change runs as one transaction that:

  1. locks the schedule;
  2. deletes all of its weekly entries and day overrides;
  3. turns weekly repetition off and clears its source week;
  4. marks every confirmed appointment on the schedule as occupying its whole booked interval;
  5. stores the new mode, together with any other settings sent in the same change.

Appointments are never cancelled or removed by a mode change. They stay confirmed and continue to block their time. The owner then sets new availability in the new mode.

Archiving a schedule​

Archiving is the only way to remove a schedule. It sets the archive time and closes both booking channels and repetition. The schedule row, its public code, services, appointments, and history are kept, and the code is never reused.

An archived schedule no longer accepts configuration, services, availability changes, or manual bookings, and it stops counting toward the allowance. Its appointment history can still be read by the owner. The schedule list returns archived schedules with their archive time, so a client of the API can decide whether to show them.