Major refactor WIP

This commit is contained in:
2026-04-03 11:13:44 -04:00
parent dee58e0aae
commit 7b2de645db
25 changed files with 5841 additions and 7760 deletions
+18
View File
@@ -6,6 +6,9 @@ from app.models.overflight import Overflight, OverflightStatus
from app.schemas.overflight import OverflightCreate, OverflightUpdate, OverflightStatusUpdate
from app.models.journal import EntityType
from app.crud.crud_journal import journal
from app.crud.crud_movement import movement as movement_crud
from app.schemas.movement import MovementCreate
from app.models.movement import MovementType
class CRUDOverflight:
@@ -57,6 +60,21 @@ class CRUDOverflight:
db.commit()
db.refresh(db_obj)
# Create OVERFLIGHT movement if call_dt is set
if db_obj.call_dt:
movement_data = MovementCreate(
movement_type=MovementType.OVERFLIGHT,
aircraft_registration=db_obj.registration,
aircraft_type=db_obj.type,
timestamp=db_obj.call_dt,
entity_type="OVERFLIGHT",
entity_id=db_obj.id,
from_location=db_obj.departure_airfield,
to_location=db_obj.destination_airfield,
created_by=created_by
)
movement_crud.create(db, movement_data)
# Log creation in journal
journal.log_change(
db,