Getting there

This commit is contained in:
2025-12-12 11:18:28 -05:00
parent f7467690e4
commit dbb285fa20
15 changed files with 1080 additions and 36 deletions

View File

@@ -19,7 +19,7 @@ class LocalFlightStatus(str, Enum):
class LocalFlightBase(BaseModel):
registration: str
type: str # Aircraft type
type: Optional[str] = None # Aircraft type - optional, can be looked up later
callsign: Optional[str] = None
pob: int
flight_type: LocalFlightType
@@ -31,11 +31,13 @@ class LocalFlightBase(BaseModel):
raise ValueError('Aircraft registration is required')
return v.strip().upper()
@validator('type')
@validator('type', pre=True, always=False)
def validate_type(cls, v):
if not v or len(v.strip()) == 0:
raise ValueError('Aircraft type is required')
return v.strip()
if v is None or (isinstance(v, str) and len(v.strip()) == 0):
return None
if isinstance(v, str):
return v.strip()
return v
@validator('pob')
def validate_pob(cls, v):