A reservation of one seat of a service.
Exactly one time shape per row (DB CHECK bookings_time_shape, mirrors
the phoenix_kit_calendar V141 convention):
- Timed (
minutesservices):starts_at/ends_atUTC pair, exclusive end. - Dated (
day/nightservices):starts_on/ends_onDATE pair, exclusive end — a Fri→Sun hotel stay isstarts_on: Fri, ends_on: Sun(2 nights). Check-in/out clock times are service attributes, never range data.
The time fields, service_uuid, user_uuid, status and source are
never cast from attrs — PhoenixKitBookings.Bookings computes and
put_changes them after the engine validates the request. The changeset
casts only what a customer types.
Lifecycle: pending (approval-required services) → confirmed →
cancelled. Cancelled rows keep their time fields but stop counting
toward capacity.
Summary
Functions
True when the booking still occupies capacity.
Casts only customer-supplied fields.
Stamps the validated time range, ownership and lifecycle onto a customer
changeset. range is {starts_at, ends_at} (DateTime) or
{:dates, starts_on, ends_on} (Date).
Controlled status transition — never cast from attrs.
Types
@type t() :: %PhoenixKitBookings.Schemas.Booking{ __meta__: term(), cancel_reason: term(), cancelled_at: term(), currency: term(), customer_email: term(), customer_name: term(), customer_phone: term(), ends_at: term(), ends_on: term(), inserted_at: term(), metadata: term(), notes: term(), service_uuid: term(), source: term(), starts_at: term(), starts_on: term(), status: term(), total_price: term(), unit_uuid: term(), updated_at: term(), user_uuid: term(), uuid: term() }
Functions
True when the booking still occupies capacity.
Casts only customer-supplied fields.
Stamps the validated time range, ownership and lifecycle onto a customer
changeset. range is {starts_at, ends_at} (DateTime) or
{:dates, starts_on, ends_on} (Date).
Controlled status transition — never cast from attrs.