Baseleg Docs

Aircraft

Status: v1 primary
Packages: packages/domain/aircraft, packages/application/aircraft

Purpose

The Aircraft context manages the fleet: what aircraft exist, their details, and their operational state. It is the authoritative source of whether an aircraft is available or grounded. The Scheduling context consults Aircraft state before allowing a booking.

Entities

Aircraft (aggregate root)

Represents a single aircraft in the fleet.

Key attributes:

  • id — unique identifier
  • registration — official registration mark (e.g. ZK-ABC); unique and immutable after creation
  • type — aircraft type / model (e.g. Cessna 172)
  • statusavailable | grounded
  • groundedReason — required when status is grounded; null otherwise
  • groundedAt — timestamp of when grounding was applied
  • groundedByMemberId of the staff member who applied the grounding

Value objects

  • AircraftId — typed identifier wrapping a UUID.
  • Registration — validated aircraft registration string; enforces format (e.g. alphanumeric, country prefix).
  • GroundedReason — non-empty string describing why the aircraft is grounded.

Domain rules

  1. Registration must be unique within the organisation.
  2. An aircraft cannot be booked when its status is grounded.
  3. Grounding requires a groundedReason; it may not be empty.
  4. Only authorised personnel (Staff role) can ground or unground an aircraft.
  5. An aircraft cannot be hard-deleted if it has associated Bookings or Flights; deactivation or status annotation is used instead.

Key use cases

  • addAircraft — register a new aircraft in the fleet.
  • updateAircraft — update aircraft details (type, notes).
  • groundAircraft — transition status to grounded with a mandatory reason.
  • ungroundAircraft — transition status back to available; clears grounding fields.
  • listAircraft — return all aircraft with current status (filterable by status).
  • getAircraft — return a single aircraft by ID or registration.

Cross-context relationships

ContextUsage
SchedulingChecks aircraft status before allowing a Booking; holds AircraftId on a Booking
ComplianceReferences AircraftId for airworthiness document tracking
ReportingReads aircraft utilisation data (infrastructure layer only)

The Aircraft context does not import from Scheduling or People. It owns fleet state; other contexts reference it by AircraftId.