Data model

Lists, relationships, statuses, and the append-only rules of the Travel Agent schema.

The schema has 37 lists in features/keystone/models. schema.graphql and schema.prisma in the repository are the reference for a revision.

Rules

  • Money is whole cents with a currency code. Rates are basis points.
  • Every list has createdAt and updatedAt.
  • Status fields cannot be written by a raw create or update. They change through custom mutations that check the current state, then write an AuditEvent.
  • Customer-visible codes (tripNumber, invoice number) are random, never sequential.
  • Link tokens are random and stored only as SHA-256 hashes.
  • Paid records keep a snapshot of what was bought. An invoice line stores description, amount, quantity, fees, and tax. A booked component stores a purchase snapshot. An accepted proposal stores a snapshot and its hash.

Lists

AreaLists
IdentityUser, Role, OAuthApp, OAuthToken
CRMClient, Traveler, Inquiry, Destination
Trip and proposalTrip, Proposal, ProposalOption, ProposalItem, TripComponent, ItineraryDay, ItineraryItem
SuppliersSupplier, SupplierContact
MoneyClientInvoice, ClientInvoiceLine, PaymentSchedule, ClientFundsEntry, SupplierPayment, CommissionReceipt, CommissionAllocation, AdvisorCommissionLedger
PaymentsPaymentProvider, PaymentCollection, PaymentSession, Payment, Refund, PaymentWebhookEvent
ControlManagerApproval, AuditEvent, IdempotencyKey, AgencySettings
WorkDocument, Task

Core relationships

FromTo
ClientTraveler, Inquiry, Trip
TripClient, User (advisor), Inquiry, Destination, Traveler, Proposal, TripComponent, ItineraryDay, ClientInvoice, PaymentSchedule, ClientFundsEntry, Task, Document
ProposalProposalOption, which has ProposalItem
TripComponentSupplier, Traveler, PaymentSchedule, ClientFundsEntry, SupplierPayment, CommissionAllocation, AdvisorCommissionLedger, ItineraryItem
ClientInvoiceClientInvoiceLine, PaymentCollection, Payment, Refund
PaymentPaymentProvider, Refund, PaymentWebhookEvent
CommissionReceiptSupplier, CommissionAllocation
CommissionAllocationTripComponent, ManagerApproval
ClientFundsEntryTrip, TripComponent, and the entry it reverses
ManagerApprovalUser (requested by), User (approved by)
UserRole, Trip, Inquiry, Task, AuditEvent, AdvisorCommissionLedger

Status values

ListFieldValues
Tripstatusplanning, proposal_sent, accepted, booked, final_payment_due, paid_in_full, traveling, completed, cancelled
Inquirystatusnew, qualifying, proposal, won, lost
InquirytripTypehoneymoon, family, group, corporate, cruise, adventure
Proposalstatusdraft, sent, viewed, accepted, superseded, declined
ProposalItem, TripComponentkindhotel, cruise, tour, flight, transfer, rail, insurance, activity, fee
TripComponentbookingStatusquoted, held, booked, ticketed, cancelled
TripComponentpaymentModelclient_pays_supplier, agency_collects
TripComponentcommissionStatusexpected, invoiced, received, short_paid, written_off
Supplierkindhotel, cruise_line, tour_operator, dmc, airline, consolidator, insurer, transfer
ClientInvoicestatusdraft, sent, partially_paid, paid, void
ClientInvoiceLinekindplanning_fee, component_deposit, component_final, insurance
PaymentSchedulestatusdue, invoiced, paid, cancelled
ClientFundsEntryentryTypereceipt, supplier_payment, refund_to_client, transfer_planning_fee, reversal
AdvisorCommissionLedgerentryTypeallocation, reversal
Paymentstatuspending, processing, authorized, unknown, succeeded, failed, cancelled, refunded, partially_refunded
Refundstatusprocessing, succeeded, failed, unknown
ManagerApprovalstatusrequested, approved, rejected, consumed
ManagerApprovalactionTyperefund_payment, commission_overpayment, commission_writeoff
Tasktypedeposit_due, final_due, passport_expiring, commission_overdue, follow_up
Taskstatusopen, completed, cancelled
Documentkindpassport, visa, insurance, supplier_confirmation, signed_terms

Computed fields

  • Trip.totalSellCents, collectedCents, balanceDueCents, and expectedCommissionCents. Cancelled components are left out. Balance counts only the planning fee and agency_collects components.
  • Client.lifetimeValueCents: the sum collected on the client's invoices.

Append-only and protected

  • AuditEvent, ClientFundsEntry, AdvisorCommissionLedger, CommissionReceipt, CommissionAllocation, SupplierPayment, invoices, and payments are never created or edited through the generic API.
  • ManagerApproval cannot be created or updated through the generic API either.
  • Traveler date of birth, passport expiry, and known traveler number cannot be read through the generic API.
  • Deleting is closed on every agency list.

On this page