MolinoPro

trip-booking-model

Master Codebase Guidebook
Markdown + HTML Dev-Docs Renderer - Frontend Client Module

Default Index
Open README.md
Root: README.mdRoot
Milestones
H1🧠 Trip & Booking Domain Model — Molino + Legacy Reference

last_updated: 2026-04-30


H2📦 Current Commercial Lanes in Molino
LaneStatusDescription
Tours/Experiences✅ WorkingFareHarbor Lightframe modal, booking buttons on trips/cities/experiences
Trip Join✅ WiredcreateTripJoin → creates TripJoin record with recalculated pricing
Featured Trips✅ DoneFixed FH price, no recalculation
Private Trips⚡ In ProgressJoin → recalculate via tripEngine, booking pending
Hotels⏳ PlannedSeparate lane: estimate OR FH OR external links
Bookings Export✅ PDF wired/trips/[tripId]/export/pdf

H2🏗️ Trip Domain — Current State
H3Entities (Prisma)
EntityRoleStatus
TripCore trip with cities, dates, pax
TripCityCity in trip with nights, guide, tours
TripJoinParticipant join record
TripJoinQuoteQuote snapshot
PricingComputed via tripEngine
H3Trip Pricing Engine
tripEngine(input: TripInput) → TripPricingOutput
  - totalBase (raw)
  - totalWithMarkup (margin)
  - lineItems[]
H3Join Flow (Wired This Session)
User clicks "Join this trip"
  ↓
TripJoinPanel → createTripJoin({ tripId, pax, rooms, hotelStandard })
  ↓
createTripJoin action:
  - Loads Trip + Cities from Prisma
  - Maps to TripInput
  - Calls tripEngine({ ...input, numPax, numDoubleRooms, numSingleRooms })
  - Creates TripJoin with pricingSnapshot
  - Returns joinId

H2🏗️ Legacy NestJS Backend Reference

Located: legacy-version-reference/

H3Endpoint Surface (what legacy calls)
GET    /trips              → list trips
POST   /trips              → create trip
GET    /trips/:id          → get trip detail
PATCH  /trips/:id         → update trip
GET    /cities             → list cities
GET    /plans              → list city plans (experiences)
GET    /trip-cities        → trip city relations
POST   /trip-city-plan     → bind plan to trip city
GET    /bookings           → list bookings
POST   /bookings           → create booking
H3Legacy Service Layer
ServiceMolino Equivalent
trips.tstrip-engine/ + trips.read.actions.ts
cities.tscities seed + Prisma City
plans.tsgetFeaturedExperiences → Experience
tripCities.tsTripCity (via cities relation)
tripCityPlans.tsBinding Experience to TripCity
bookings.tsTripJoin + BookingBundle (planned)

H2🎯 Optimization Targets — Ordered by Priority
H3P0 — Must Ship
  1. Trip Booking Flow

    • TripJoin created ✅
    • Confirm/Pay step (link to FH or manual)
    • Confirmation email
  2. Hotels Lane

    • Decision: estimate OR FH OR external
    • UI: show/hide based on hotel policy
H3P1 — Should Ship
  1. Trip Sharing

    • Share private trip via email
    • Invitee sees trip with join option
    • Invite accepted → recalculates
  2. TripCity Plans Binding

    • UI to bind Experiences (plans) to TripCity
    • Maps to city.tours in Prisma
H3P2 — Can Wait
  1. Booking Export

    • /trips/[tripId]/export/email — email template
    • /trips/[tripId]/export/calendar — .ics
  2. TripCity Updates

    • Sync TripCity when Experience content changes

H2🔌 Mapping Legacy → Molino
Legacy APIMolino Action/Route
GET /tripsgetTrips (read actions)
POST /tripscreateTrip (create action)
GET /trips/:idgetTripById (read actions)
PATCH /trips/:idupdateTrip (update action)
GET /plansgetFeaturedExperiences
POST /trip-city-planBind Experience via updateTripCity
GET /bookingsTripJoin list (future)
POST /bookingscreateTripJoin → BookingBundle

H2📝 Notes
  • Hotels remain separate commercial lane
  • TripJoin ≠ BookingBundle (TripJoin is intent, BookingBundle is execution)
  • FH for experiences only; trip pricing managed internally
  • Legacy NestJS backend provides patterns to migrate later if needed

Reference files:

  • Legacy actions: legacy-version-reference/actions/*.ts
  • Legacy frontend shell: legacy-version-reference/legacy-trips-frontend-shell.md
  • Current engine: app/trips/actions/trip-engine/