Overflights implementation

This commit is contained in:
2025-12-19 05:07:46 -05:00
parent 658d4c4ff8
commit b46a88d471
10 changed files with 959 additions and 5 deletions

View File

@@ -10,6 +10,7 @@ class EntityType(str, PyEnum):
LOCAL_FLIGHT = "LOCAL_FLIGHT"
ARRIVAL = "ARRIVAL"
DEPARTURE = "DEPARTURE"
OVERFLIGHT = "OVERFLIGHT"
class JournalEntry(Base):

View File

@@ -0,0 +1,28 @@
from sqlalchemy import Column, Integer, String, DateTime, Text, Enum as SQLEnum, BigInteger
from sqlalchemy.sql import func
from enum import Enum
from app.db.session import Base
class OverflightStatus(str, Enum):
ACTIVE = "ACTIVE"
INACTIVE = "INACTIVE"
CANCELLED = "CANCELLED"
class Overflight(Base):
__tablename__ = "overflights"
id = Column(BigInteger, primary_key=True, autoincrement=True)
registration = Column(String(16), nullable=False, index=True)
pob = Column(Integer, nullable=True) # Persons on board
type = Column(String(32), nullable=True) # Aircraft type
departure_airfield = Column(String(64), nullable=True, index=True) # Airfield they departed from
destination_airfield = Column(String(64), nullable=True, index=True) # Where they're heading
status = Column(SQLEnum(OverflightStatus), nullable=False, default=OverflightStatus.ACTIVE, index=True)
call_dt = Column(DateTime, nullable=False, index=True) # Time of initial call
qsy_dt = Column(DateTime, nullable=True) # Time of frequency change (QSY)
notes = Column(Text, nullable=True)
created_dt = Column(DateTime, nullable=False, server_default=func.current_timestamp(), index=True)
created_by = Column(String(16), nullable=True, index=True)
updated_at = Column(DateTime, nullable=False, server_default=func.current_timestamp(), onupdate=func.current_timestamp())