feat: add smart flight tracking with AviationStack API + visual progress
- Add 20+ flight fields (terminal, gate, delays, estimated times, etc.) - Smart polling cron with budget-aware priority queue (100 req/month) - Tracking phases: FAR_OUT → PRE_DEPARTURE → ACTIVE → LANDED - Visual FlightProgressBar with animated airplane between airports - FlightCard with status dots, delay badges, expandable details - FlightList rewrite: card-based, grouped by status, search/filter - Dashboard: enriched flight status widget with compact progress bars - CommandCenter: flight alerts + enriched arrivals with gate/terminal Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -73,6 +73,7 @@ model VIP {
|
||||
enum Department {
|
||||
OFFICE_OF_DEVELOPMENT
|
||||
ADMIN
|
||||
OTHER
|
||||
}
|
||||
|
||||
enum ArrivalMode {
|
||||
@@ -97,13 +98,70 @@ model Flight {
|
||||
scheduledArrival DateTime?
|
||||
actualDeparture DateTime?
|
||||
actualArrival DateTime?
|
||||
status String? // scheduled, delayed, landed, etc.
|
||||
status String? // scheduled, active, landed, cancelled, incident, diverted
|
||||
|
||||
// Airline info (from AviationStack API)
|
||||
airlineName String?
|
||||
airlineIata String? // "AA", "UA", "DL"
|
||||
|
||||
// Terminal/gate/baggage (critical for driver dispatch)
|
||||
departureTerminal String?
|
||||
departureGate String?
|
||||
arrivalTerminal String?
|
||||
arrivalGate String?
|
||||
arrivalBaggage String?
|
||||
|
||||
// Estimated times (updated by API, distinct from scheduled)
|
||||
estimatedDeparture DateTime?
|
||||
estimatedArrival DateTime?
|
||||
|
||||
// Delay in minutes (from API)
|
||||
departureDelay Int?
|
||||
arrivalDelay Int?
|
||||
|
||||
// Aircraft info
|
||||
aircraftType String? // IATA type code e.g. "A321", "B738"
|
||||
|
||||
// Live position data (may not be available on free tier)
|
||||
liveLatitude Float?
|
||||
liveLongitude Float?
|
||||
liveAltitude Float?
|
||||
liveSpeed Float? // horizontal speed
|
||||
liveDirection Float? // heading in degrees
|
||||
liveIsGround Boolean?
|
||||
liveUpdatedAt DateTime?
|
||||
|
||||
// Polling metadata
|
||||
lastPolledAt DateTime?
|
||||
pollCount Int @default(0)
|
||||
trackingPhase String @default("FAR_OUT") // FAR_OUT, PRE_DEPARTURE, DEPARTURE_WINDOW, ACTIVE, ARRIVAL_WINDOW, LANDED, TERMINAL
|
||||
autoTrackEnabled Boolean @default(true)
|
||||
lastApiResponse Json? // Full AviationStack response for debugging
|
||||
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@map("flights")
|
||||
@@index([vipId])
|
||||
@@index([flightNumber, flightDate])
|
||||
@@index([trackingPhase])
|
||||
@@index([scheduledDeparture])
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// Flight API Budget Tracking
|
||||
// ============================================
|
||||
|
||||
model FlightApiBudget {
|
||||
id String @id @default(uuid())
|
||||
monthYear String @unique // "2026-02" format
|
||||
requestsUsed Int @default(0)
|
||||
requestLimit Int @default(100)
|
||||
lastRequestAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@map("flight_api_budget")
|
||||
}
|
||||
|
||||
// ============================================
|
||||
|
||||
Reference in New Issue
Block a user