Skip to content
51 changes: 45 additions & 6 deletions api-spec/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2136,10 +2136,10 @@ paths:
format: uuid
- name: format
in: query
description: PDF format — easa (AMC1 FCL.050 two-page spread), faa (ASA/Jeppesen layout), or summary (simplified totals)
description: PDF format — easa (AMC1 FCL.050 two-page spread), faa (ASA/Jeppesen layout), glider (EASA SPL sailplane logbook with launch columns), or summary (simplified totals)
schema:
type: string
enum: [easa, faa, summary]
enum: [easa, faa, glider, summary]
default: easa
- name: page_size
in: query
Expand Down Expand Up @@ -3987,9 +3987,24 @@ components:
description: Whether this flight was a Proficiency Check (EASA FCL.740.A MEP/SET, FCL.625.A IR, or FAA §61.58)
launchMethod:
type: [string, 'null']
enum: [winch, aerotow, self-launch, 'null']
enum: [winch, aerotow, self-launch, bungee, auto-tow, 'null']
example: winch
description: Launch method for glider/SPL flights (winch, aerotow, or self-launch)
description: Launch method for glider/SPL flights (winch, aerotow, self-launch, bungee, or auto-tow)
launches:
type: integer
minimum: 0
example: 1
description: Number of launches on this flight (EASA FCL.140.S). Defaults to 1 for glider flights; a club training row may chain several launches in one entry. 0 for powered flights.
releaseAltitude:
type: [integer, 'null']
minimum: 0
example: 450
description: Release / cable-break altitude in metres for winch and aerotow launches.
releaseAltitudeRef:
type: [string, 'null']
enum: [AGL, AMSL, 'null']
example: AGL
description: Reference datum for releaseAltitude (above ground level or above mean sea level).
picName:
type: [string, 'null']
example: Self
Expand Down Expand Up @@ -4178,7 +4193,19 @@ components:
type: boolean
launchMethod:
type: [string, 'null']
enum: [winch, aerotow, self-launch, 'null']
enum: [winch, aerotow, self-launch, bungee, auto-tow, 'null']
launches:
type: integer
minimum: 0
description: Number of launches on this flight (EASA FCL.140.S). Defaults to 1 for glider flights, 0 for powered flights.
releaseAltitude:
type: [integer, 'null']
minimum: 0
description: Release / cable-break altitude in metres for winch and aerotow launches.
releaseAltitudeRef:
type: [string, 'null']
enum: [AGL, AMSL, 'null']
description: Reference datum for releaseAltitude (AGL or AMSL).
picName:
type: [string, 'null']
description: Name of the PIC. Auto-set to "Self" when isPic=true, or to instructorName when isDual=true.
Expand Down Expand Up @@ -4292,7 +4319,19 @@ components:
type: boolean
launchMethod:
type: [string, 'null']
enum: [winch, aerotow, self-launch, 'null']
enum: [winch, aerotow, self-launch, bungee, auto-tow, 'null']
launches:
type: integer
minimum: 0
description: Number of launches on this flight (EASA FCL.140.S)
releaseAltitude:
type: [integer, 'null']
minimum: 0
description: Release / cable-break altitude in metres for winch and aerotow launches.
releaseAltitudeRef:
type: [string, 'null']
enum: [AGL, AMSL, 'null']
description: Reference datum for releaseAltitude (AGL or AMSL).
picName:
type: [string, 'null']
description: Name of the PIC
Expand Down
5 changes: 5 additions & 0 deletions db/migrations/000041_add_glider_launch_fields.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE flights DROP CONSTRAINT IF EXISTS chk_flights_release_altitude_requires_launch;
ALTER TABLE flights DROP CONSTRAINT IF EXISTS chk_flights_release_altitude_ref;
ALTER TABLE flights DROP COLUMN IF EXISTS release_altitude_ref;
ALTER TABLE flights DROP COLUMN IF EXISTS release_altitude_m;
ALTER TABLE flights DROP COLUMN IF EXISTS launches;
28 changes: 28 additions & 0 deletions db/migrations/000041_add_glider_launch_fields.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-- Glider/SPL operations: make launches a first-class count and record
-- release (cable-break) altitude for winch/aerotow launches.
--
-- Background: until now SPL recency (EASA FCL.140.S) used the landings count as
-- a proxy for launches. A club training row routinely chains several winch
-- launches in a single logical entry, so launches must be tracked separately.

ALTER TABLE flights
ADD COLUMN launches INTEGER NOT NULL DEFAULT 0,
ADD COLUMN release_altitude_m INTEGER,
ADD COLUMN release_altitude_ref VARCHAR(4);

-- Constrain the reference datum.
ALTER TABLE flights
ADD CONSTRAINT chk_flights_release_altitude_ref
CHECK (release_altitude_ref IS NULL OR release_altitude_ref IN ('AGL', 'AMSL'));

-- Release altitude only makes sense alongside a launch method.
ALTER TABLE flights
ADD CONSTRAINT chk_flights_release_altitude_requires_launch
CHECK (release_altitude_m IS NULL OR launch_method IS NOT NULL);

-- Backfill: existing glider flights (those with a launch_method) inherit their
-- landings count as the launch count so SPL currency totals are unchanged.
-- A glider flight always has at least one launch. Powered flights keep 0.
UPDATE flights
SET launches = GREATEST(COALESCE(all_landings, landings_day + landings_night, 1), 1)
WHERE launch_method IS NOT NULL;
2 changes: 1 addition & 1 deletion internal/api/generated/server.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading