Data model

Lists, relationships, statuses, and the rules of the Tour Guide schema.

The schema has 41 lists in features/keystone/models.

Rules

  • Money is whole cents (integers) with a currency code. Percentages are basis points, where 100 is 1%.
  • Every list has createdAt and updatedAt.
  • Status fields can be set when a record is created, but generated update cannot change them. Statuses that matter to sales (booking, departure, hold, assignment) change through custom operations. Tour, waiver, promo, guide, and resource statuses have no operation, so a change after creation needs a direct database edit.
  • A booking copies tour name, ticket and add-on lines, tax, discount, and the cancellation policy when it is created. Later edits to the tour do not change it.
  • Customer-facing codes are random, not sequential. A booking code looks like TG- followed by eight letters and digits.
  • Tokens are stored as hashes: the hold proof, the waiver link, and the rebook credit.
  • Audit events are append-only.

Core relationships

FromTo
TourMeetingPoint, CancellationPolicy, WaiverTemplate, TicketType, AddOn, PricingRule, Schedule, Departure, PromoCode
DepartureTour, Schedule, GuideAssignment, ResourceAssignment, InventoryHold, Booking, OperationalTask
GuideUser, GuideCertification, GuideAvailability, GuideAssignment, GuidePayout
GuidePayoutGuide, GuideAssignment
BookingDeparture, User (customer), Channel, PaymentCollection, Payment, Refund, Participant, BookingLine, InventoryHold, ChannelStatement, PromoRedemption
ParticipantBooking, WaiverSignature
WaiverSignatureParticipant, WaiverTemplate
ChannelBooking, ChannelStatement
PromoCodeTour, PromoRedemption
PaymentCollectionPaymentSession, Payment
RefundPayment, Booking, User (requester and approver)

Departure has virtual fields booked, held, remaining, guidesNeeded, and staffed.

Status values

ListValues
Tourdraft, active, archived
Departurescheduled, on_sale, min_not_met, confirmed, full, closed, in_progress, completed, cancelled, weather_cancelled
Bookingpending_payment, confirmed, checked_in, completed, no_show, cancelled, refunded, partially_refunded
Booking.sourceonline, phone, walk_up, reseller
InventoryHoldactive, converted, released, expired
Participant.waiverStatusrequired, signed, not_required
Participant.checkInStatuspending, checked_in, no_show
WaiverTemplatedraft, published, archived
GuideAssignmentoffered, accepted, declined, cancelled, worked
Guideactive, inactive
Resourceactive, maintenance
GuidePayoutdraft, approved, paid
Channel.paymentModelchannel_collects, we_collect
ChannelStatementopen, invoiced, paid
OperationalTaskopen, resolved
PromoCodeactive, paused, expired
PromoRedemptionreserved, committed, released
ManagerApprovalpending, approved, rejected, consumed, expired

Some values have no operation that sets them: a departure never becomes in_progress by itself, a guide payout stays draft, a statement stays open, and an approval is never set to rejected.

Departure status in practice

  • generateDepartures creates departures as on_sale.
  • A hold or booking that changes the booked count moves a departure between on_sale, confirmed (the minimum is reached), and full.
  • sweepDepartures sets min_not_met and closed.
  • cancelDeparture sets cancelled or weather_cancelled.
  • closeDeparture sets completed, but only for a closed or in_progress departure whose end time has passed.

Holds

A hold lasts 10 minutes. Starting checkout extends it to 15 minutes. Expired holds free their seats at once, because the seat count ignores them. They are marked expired the next time a hold is placed on that departure.

Lists with no behavior yet

PricingRule, NotificationPreference, and the GuideAvailability.weeklyRules field are stored and editable, but no operation reads them.

On this page