From f7d28e656d04d460e66a6079e3e67d14a4d063ee Mon Sep 17 00:00:00 2001 From: Joao Pedro Henrique Date: Sun, 17 Sep 2023 18:15:46 -0300 Subject: [PATCH] style: run prettier on code --- packages/app/app/api/flights/all/route.ts | 4 +++- packages/app/app/api/flights/route.ts | 4 +++- packages/app/src/components/SearchFlightsForm/index.tsx | 4 +--- packages/app/src/services/fetch-flights.ts | 4 +++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/app/app/api/flights/all/route.ts b/packages/app/app/api/flights/all/route.ts index c33965d5..d021eb99 100644 --- a/packages/app/app/api/flights/all/route.ts +++ b/packages/app/app/api/flights/all/route.ts @@ -62,7 +62,9 @@ export async function GET(request: Request) { orderBy: (fields, { desc }) => desc(fields.id), where: (fields, { sql, and, eq }) => and( - data.data.cycle ? sql`${fields.cycle} IN ${data.data.cycle}` : eq(fields.cycle, currentCycleSubquery), + data.data.cycle + ? sql`${fields.cycle} IN ${data.data.cycle}` + : eq(fields.cycle, currentCycleSubquery), data.data.departureIcao && sql`${fields.departureIcao} IN ${data.data.departureIcao}`, data.data.arrivalIcao && diff --git a/packages/app/app/api/flights/route.ts b/packages/app/app/api/flights/route.ts index 31d910ec..7d99017a 100644 --- a/packages/app/app/api/flights/route.ts +++ b/packages/app/app/api/flights/route.ts @@ -68,7 +68,9 @@ export async function GET(request: Request) { } const criteria = and( - data.data.cycle ? sql`${flights.cycle} IN ${data.data.cycle}` : eq(flights.cycle, currentCycleSubquery), + data.data.cycle + ? sql`${flights.cycle} IN ${data.data.cycle}` + : eq(flights.cycle, currentCycleSubquery), data.data.departureIcao && sql`${flights.departureIcao} IN ${data.data.departureIcao}`, data.data.arrivalIcao && diff --git a/packages/app/src/components/SearchFlightsForm/index.tsx b/packages/app/src/components/SearchFlightsForm/index.tsx index f8a8ff22..da831d7d 100644 --- a/packages/app/src/components/SearchFlightsForm/index.tsx +++ b/packages/app/src/components/SearchFlightsForm/index.tsx @@ -67,9 +67,7 @@ const SearchFlightsForm: FC = ({ options={cyclesOptions} name="cycle" defaultValue={cyclesOptions[0]} - onChange={(cycle) => - setForm((form) => ({ ...form, cycle })) - } + onChange={(cycle) => setForm((form) => ({ ...form, cycle }))} /> diff --git a/packages/app/src/services/fetch-flights.ts b/packages/app/src/services/fetch-flights.ts index e837b96b..903568ea 100644 --- a/packages/app/src/services/fetch-flights.ts +++ b/packages/app/src/services/fetch-flights.ts @@ -37,7 +37,9 @@ export async function fetchFlights(searchParams: Record) { const flights = await db.query.flights.findMany({ where: (fields, { sql, and, eq, or }) => and( - where.cycle ? eq(fields.cycle, where.cycle) : eq(fields.cycle, currentCycleSubquery), + where.cycle + ? eq(fields.cycle, where.cycle) + : eq(fields.cycle, currentCycleSubquery), where.departureIcao ? eq(fields.departureIcao, where.departureIcao) : undefined,