From dec39fb319ae64d5c36db134769bd006557aea20 Mon Sep 17 00:00:00 2001 From: jacoblurie29 Date: Sun, 14 Jan 2024 13:06:47 -0600 Subject: [PATCH] Fixed prettier and eslint errors --- .../TestControllers/retrievePassengers.ts | 35 +++-- src/data/constants.ts | 145 +++++++++--------- src/interfaces/flight-leg.interface.ts | 107 +++++++------ src/interfaces/passenger.interface.ts | 93 ++++++----- 4 files changed, 189 insertions(+), 191 deletions(-) diff --git a/src/controllers/TestControllers/retrievePassengers.ts b/src/controllers/TestControllers/retrievePassengers.ts index 6ee24fb..3b98ac3 100644 --- a/src/controllers/TestControllers/retrievePassengers.ts +++ b/src/controllers/TestControllers/retrievePassengers.ts @@ -1,5 +1,3 @@ -/* eslint-disable autofix/no-unused-vars */ -/* eslint-disable @typescript-eslint/no-unused-vars */ import Airtable from 'airtable'; import dotenv from 'dotenv'; import type { FieldSet, Record } from 'airtable'; @@ -12,8 +10,7 @@ export const retrievePassengers = async (req: Request, res: Response) => { console.log(process.env.AIRTABLE_API_KEY); const base = new Airtable({ - apiKey: - process.env.AIRTABLE_API_KEY || "", + apiKey: process.env.AIRTABLE_API_KEY || '', }).base('appwPsfAb6U8CV3mf'); base('Flight Requests (Trips)') @@ -24,25 +21,29 @@ export const retrievePassengers = async (req: Request, res: Response) => { }) .firstPage(async function (err, records) { if (err) { - console.error(err); - return; + console.error(err); + return; } if (records) { - const flightLegs = records.map(record => record.fields["Flight Legs"] !== undefined ? record.fields["Flight Legs"] : []) as string[][]; - console.log('Retrieved Flight Leg IDs', flightLegs); - - try { - + const flightLegs = records.map(record => + record.fields['Flight Legs'] !== undefined + ? record.fields['Flight Legs'] + : [] + ) as string[][]; + console.log('Retrieved Flight Leg IDs', flightLegs); + + try { const trips = [] as Record
[][]; const promises = flightLegs.map(async trip => { const flightLegsForTrip = [] as Record
[]; const tripPromises = trip.map(async flightLegId => { - const flightLegRecord = await base('Flight Legs').find(flightLegId?.toString() || ''); // Replace with your actual table name + const flightLegRecord = await base('Flight Legs').find( + flightLegId?.toString() || '' + ); // Replace with your actual table name flightLegsForTrip.push(flightLegRecord); }); await Promise.all(tripPromises); trips.push(flightLegsForTrip); - }); await Promise.all(promises); @@ -51,9 +52,9 @@ export const retrievePassengers = async (req: Request, res: Response) => { // Send the response or do further processing res.status(200).send(trips); - } catch(err) { - console.error(err); - } + } catch (err) { + console.error(err); + } } - }); + }); }; diff --git a/src/data/constants.ts b/src/data/constants.ts index 25d83f9..7278d32 100644 --- a/src/data/constants.ts +++ b/src/data/constants.ts @@ -1,74 +1,73 @@ export const AIRLINES = [ - "AA - American Airlines", - "AC - Air Canada", - "AE - American Eagle", - "AF - Air France", - "AG - Allegiant", - "AI - Air India", - "AK - Alaska", - "AL - Aer Lingus", - "AM - AeroMexico", - "AN - Air New Zealand", - "AO - Aeroflot", - "AR - Air Transat", - "AS - Air Serbia", - "AT - AirTran", - "ATA - American Trans Air", - "AU - Austrian Airlines", - "AV - Avianca", - "AW - America West", - "BA - British Airways", - "BH - Bahamasair", - "BS - Big Sky", - "CA - Corporate Airlines", - "CM - Com-Air", - "CN - Canadian Airlines", - "CO - Continental", - "CP - Copa Airlines", - "DA - Domodedovo Airlines", - "DL - Delta", - "EJ - Express Jet", - "EK - Emirates", - "FT - Frontier", - "GA - Grenadine Air Alliance", - "GL - Great Lakes", - "HA - Horizon Airlines", - "HI - Hawaiian Airlines", - "IA - Island Air", - "IC - Iceland Air", - "JB - JetBlue Airways", - "KLM - KLM Royal Dutch Airlines", - "LH - Lufhansa", - "LT - Liat Airlines", - "ME - Midway", - "MS - Mesaba", - "MU - Mustique Airways", - "MW - Midwest", - "MX - Mexicana", - "NA - National", - "NW - Northwest", - "OC - One Caribbean", - "QA - Qantas", - "RA - Ravn Alaska", - "SA - South African", - "SC - SunCountry", - "SK - Skywest", - "SM - Skyway", - "SN - Scandinavian", - "SP - Spirit", - "SVG - SVG Air", - "SW - Southwest", - "TA - Tropic Air", - "TK - Turkish Airlines", - "TWA - TransWorld Air", - "UN - United", - "US - US Airways", - "VA - Vanguard", - "VG - Virgin America", - "VL - Volaris Airlines", - "WJ - West Jet", - "US - US Aiways", - "SAE - Southern Airways Express", - "Qatar Airways", - ]; - \ No newline at end of file + 'AA - American Airlines', + 'AC - Air Canada', + 'AE - American Eagle', + 'AF - Air France', + 'AG - Allegiant', + 'AI - Air India', + 'AK - Alaska', + 'AL - Aer Lingus', + 'AM - AeroMexico', + 'AN - Air New Zealand', + 'AO - Aeroflot', + 'AR - Air Transat', + 'AS - Air Serbia', + 'AT - AirTran', + 'ATA - American Trans Air', + 'AU - Austrian Airlines', + 'AV - Avianca', + 'AW - America West', + 'BA - British Airways', + 'BH - Bahamasair', + 'BS - Big Sky', + 'CA - Corporate Airlines', + 'CM - Com-Air', + 'CN - Canadian Airlines', + 'CO - Continental', + 'CP - Copa Airlines', + 'DA - Domodedovo Airlines', + 'DL - Delta', + 'EJ - Express Jet', + 'EK - Emirates', + 'FT - Frontier', + 'GA - Grenadine Air Alliance', + 'GL - Great Lakes', + 'HA - Horizon Airlines', + 'HI - Hawaiian Airlines', + 'IA - Island Air', + 'IC - Iceland Air', + 'JB - JetBlue Airways', + 'KLM - KLM Royal Dutch Airlines', + 'LH - Lufhansa', + 'LT - Liat Airlines', + 'ME - Midway', + 'MS - Mesaba', + 'MU - Mustique Airways', + 'MW - Midwest', + 'MX - Mexicana', + 'NA - National', + 'NW - Northwest', + 'OC - One Caribbean', + 'QA - Qantas', + 'RA - Ravn Alaska', + 'SA - South African', + 'SC - SunCountry', + 'SK - Skywest', + 'SM - Skyway', + 'SN - Scandinavian', + 'SP - Spirit', + 'SVG - SVG Air', + 'SW - Southwest', + 'TA - Tropic Air', + 'TK - Turkish Airlines', + 'TWA - TransWorld Air', + 'UN - United', + 'US - US Airways', + 'VA - Vanguard', + 'VG - Virgin America', + 'VL - Volaris Airlines', + 'WJ - West Jet', + 'US - US Aiways', + 'SAE - Southern Airways Express', + 'Qatar Airways', +]; diff --git a/src/interfaces/flight-leg.interface.ts b/src/interfaces/flight-leg.interface.ts index 202edcb..da8029b 100644 --- a/src/interfaces/flight-leg.interface.ts +++ b/src/interfaces/flight-leg.interface.ts @@ -1,56 +1,55 @@ export interface FlightLegData { - id: string; - createdTime: string; - fields: { - Status: string; - Airline: string; - "BL - Departure Airport": string; - "Departure Date/Time": string; - "BL - Arrival Airport": string; - "Arrival Date/Time": string; - "Nautical Miles": number; - PUR: number; - "BL - # of PAX": number; - "BL - Treatment Type": string; - "BL - Site 1": string; - Passengers: string[]; - "Departure Airport": string; - "Arrival Airport": string; - "BL - Site 1 Links": string[]; - "Leg ID": string; - "Leg Type": string; - "# of Linked PAX": number; - "# of PAX": number; - "Total Miles": number; - "Passenger Names": string | string[]; - "Total Cost": number; - "Cost per PAX": number; - "AirTable Record ID": string; - "Request AirTable Record ID": string[]; - "Passenger AirTable Record IDs": string | string[]; - "Log Airline Credit": { - label: string; - url: string; - }; - "Creation Date": string; - "Patient Name": string[]; - "State (from Passengers)": string[]; - "State (from Departure Airport)": string[]; - "State (from Arrival Airport)": string[]; - "State (from Passengers) 2": string[]; - "State (from Departure Airport) 2": string[]; - "Date of Birth (from Passengers)": string[]; - "Patient Latest Trip": string[]; - "Is Latest Trip": string; - "Home Phone (from Passengers)": string[]; - "Street (from Passengers)": string[]; - City: string[]; - "State (from Passengers) 3": string[]; - "Zip (from Passengers)": string[]; - "Diagnosis (from Passengers)": string[]; - "Date of Birth (from Passengers) 2": string[]; - "TS City, State (from Treatment Site Totals 2) (from Passengers)": string[]; - "48 Hours After Flight": string; + id: string; + createdTime: string; + fields: { + Status: string; + Airline: string; + 'BL - Departure Airport': string; + 'Departure Date/Time': string; + 'BL - Arrival Airport': string; + 'Arrival Date/Time': string; + 'Nautical Miles': number; + PUR: number; + 'BL - # of PAX': number; + 'BL - Treatment Type': string; + 'BL - Site 1': string; + Passengers: string[]; + 'Departure Airport': string; + 'Arrival Airport': string; + 'BL - Site 1 Links': string[]; + 'Leg ID': string; + 'Leg Type': string; + '# of Linked PAX': number; + '# of PAX': number; + 'Total Miles': number; + 'Passenger Names': string | string[]; + 'Total Cost': number; + 'Cost per PAX': number; + 'AirTable Record ID': string; + 'Request AirTable Record ID': string[]; + 'Passenger AirTable Record IDs': string | string[]; + 'Log Airline Credit': { + label: string; + url: string; }; - } - \ No newline at end of file + 'Creation Date': string; + 'Patient Name': string[]; + 'State (from Passengers)': string[]; + 'State (from Departure Airport)': string[]; + 'State (from Arrival Airport)': string[]; + 'State (from Passengers) 2': string[]; + 'State (from Departure Airport) 2': string[]; + 'Date of Birth (from Passengers)': string[]; + 'Patient Latest Trip': string[]; + 'Is Latest Trip': string; + 'Home Phone (from Passengers)': string[]; + 'Street (from Passengers)': string[]; + City: string[]; + 'State (from Passengers) 3': string[]; + 'Zip (from Passengers)': string[]; + 'Diagnosis (from Passengers)': string[]; + 'Date of Birth (from Passengers) 2': string[]; + 'TS City, State (from Treatment Site Totals 2) (from Passengers)': string[]; + '48 Hours After Flight': string; + }; +} diff --git a/src/interfaces/passenger.interface.ts b/src/interfaces/passenger.interface.ts index 3f72450..e6aeb32 100644 --- a/src/interfaces/passenger.interface.ts +++ b/src/interfaces/passenger.interface.ts @@ -1,48 +1,47 @@ export interface PassengerData { - id: string; - createdTime: string; - fields: { - Type: string; - "First Name": string; - "Last Name": string; - "Date of Birth": string; - Gender: string; - Street: string; - Country: string; - Email: string; - "Household Income": number; - "Household Size": number; - Ethnicity: string[]; - "Military Service": string; - "Military Member": string[]; - "How did you hear about us": string[]; - "BL - Account Number": string; - "All Flight Legs": string[]; - Diagnosis: string[]; - "Treatment Site Totals 2": string[]; - "Passenger ID": string; - "AirTable Record ID": string; - "# of Flight Legs": number; - "# of Booked Flight Requests (Patient)": number; - "# of Booked Flight Requests (Pass 2)": number; - "# of Booked Flight Requests (Pass 3)": number; - "# of Booked Flight Requests (Accompanying)": number; - "# of Booked Flight Requests": number; - "Departure Date/Time (from All Flight Legs)": string[]; - "Name (from Treatment Site Totals 2)": string[]; - "Name (from Treatment Site Totals 2) 2": string[]; - "PUR (from All Flight Legs)": number[]; - "Birth Month": string; - "Full Name": string; - "Passenger Names (from All Flight Legs)": string[]; - "# of Accompanying Passengers": number; - Age: number; - Birthday: string; - "Day Before Birthday": string; - "BL - Site 1 (from All Flight Legs)": string[]; - Created: string; - "Latest Trip": string; - "TS City, State (from Treatment Site Totals 2)": string[]; - }; - } - \ No newline at end of file + id: string; + createdTime: string; + fields: { + Type: string; + 'First Name': string; + 'Last Name': string; + 'Date of Birth': string; + Gender: string; + Street: string; + Country: string; + Email: string; + 'Household Income': number; + 'Household Size': number; + Ethnicity: string[]; + 'Military Service': string; + 'Military Member': string[]; + 'How did you hear about us': string[]; + 'BL - Account Number': string; + 'All Flight Legs': string[]; + Diagnosis: string[]; + 'Treatment Site Totals 2': string[]; + 'Passenger ID': string; + 'AirTable Record ID': string; + '# of Flight Legs': number; + '# of Booked Flight Requests (Patient)': number; + '# of Booked Flight Requests (Pass 2)': number; + '# of Booked Flight Requests (Pass 3)': number; + '# of Booked Flight Requests (Accompanying)': number; + '# of Booked Flight Requests': number; + 'Departure Date/Time (from All Flight Legs)': string[]; + 'Name (from Treatment Site Totals 2)': string[]; + 'Name (from Treatment Site Totals 2) 2': string[]; + 'PUR (from All Flight Legs)': number[]; + 'Birth Month': string; + 'Full Name': string; + 'Passenger Names (from All Flight Legs)': string[]; + '# of Accompanying Passengers': number; + Age: number; + Birthday: string; + 'Day Before Birthday': string; + 'BL - Site 1 (from All Flight Legs)': string[]; + Created: string; + 'Latest Trip': string; + 'TS City, State (from Treatment Site Totals 2)': string[]; + }; +}