diff --git a/frontend/src/routes/flights/api.ts b/frontend/src/routes/flights/api.ts index 02cb54be..bc7ff843 100644 --- a/frontend/src/routes/flights/api.ts +++ b/frontend/src/routes/flights/api.ts @@ -114,11 +114,7 @@ const SCHEMA_API_LAUNCH_LANDING_INFO = z.object({ }), alt: z.number(), timeHms: z.tuple([z.number(), z.number(), z.number()]), - locationId: z - .number() - .optional() - .nullable() - .transform((value) => (value === null ? undefined : value)), + locationId: z.number().optional(), }); const SCHEMA_API_IGC_METADATA = z.object({ diff --git a/src/process_igc.rs b/src/process_igc.rs index db5da419..0090b60a 100644 --- a/src/process_igc.rs +++ b/src/process_igc.rs @@ -30,6 +30,7 @@ struct LaunchLandingInfo { pos: LatLng, alt: i16, time_hms: (u8, u8, u8), + #[serde(skip_serializing_if = "Option::is_none")] location_id: Option, } @@ -37,16 +38,22 @@ struct LaunchLandingInfo { #[serde(rename_all = "camelCase")] pub struct FlightInfo { /// Name of the pilot, as configured in the flight instrument. + #[serde(skip_serializing_if = "Option::is_none")] pilot: Option, /// Name of the glider, as configured in the flight instrument. + #[serde(skip_serializing_if = "Option::is_none")] glidertype: Option, /// Name of the launch site, as configured in the flight instrument. + #[serde(skip_serializing_if = "Option::is_none")] site: Option, /// Date of flight (YYYY, MM, DD). + #[serde(skip_serializing_if = "Option::is_none")] date_ymd: Option<(u16, u8, u8)>, /// Lauch infos. + #[serde(skip_serializing_if = "Option::is_none")] launch: Option, /// Landing infos. + #[serde(skip_serializing_if = "Option::is_none")] landing: Option, /// Track length in kilometers. track_distance: f64,