Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Update schema
Browse files Browse the repository at this point in the history
  • Loading branch information
anduong96 committed Nov 27, 2023
1 parent ec1b389 commit ffda30e
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 10 deletions.
22 changes: 22 additions & 0 deletions prisma/migrations/20231127135124_/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
Warnings:
- You are about to alter the column `date` on the `AirportWeather` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `SmallInt`.
- You are about to alter the column `hour` on the `AirportWeather` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `SmallInt`.
- You are about to alter the column `month` on the `AirportWeather` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `SmallInt`.
- You are about to alter the column `year` on the `AirportWeather` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `SmallInt`.
- You are about to alter the column `flightYear` on the `Flight` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `SmallInt`.
- You are about to alter the column `flightMonth` on the `Flight` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `SmallInt`.
- You are about to alter the column `flightDate` on the `Flight` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `SmallInt`.
*/
-- AlterTable
ALTER TABLE "AirportWeather" ALTER COLUMN "date" SET DATA TYPE SMALLINT,
ALTER COLUMN "hour" SET DATA TYPE SMALLINT,
ALTER COLUMN "month" SET DATA TYPE SMALLINT,
ALTER COLUMN "year" SET DATA TYPE SMALLINT;

-- AlterTable
ALTER TABLE "Flight" ALTER COLUMN "flightYear" SET DATA TYPE SMALLINT,
ALTER COLUMN "flightMonth" SET DATA TYPE SMALLINT,
ALTER COLUMN "flightDate" SET DATA TYPE SMALLINT;
12 changes: 12 additions & 0 deletions prisma/migrations/20231127135157_/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
Warnings:
- You are about to alter the column `flightYear` on the `AircraftPosition` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `SmallInt`.
- You are about to alter the column `flightMonth` on the `AircraftPosition` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `SmallInt`.
- You are about to alter the column `flightDate` on the `AircraftPosition` table. The data in that column could be lost. The data in that column will be cast from `Integer` to `SmallInt`.
*/
-- AlterTable
ALTER TABLE "AircraftPosition" ALTER COLUMN "flightYear" SET DATA TYPE SMALLINT,
ALTER COLUMN "flightMonth" SET DATA TYPE SMALLINT,
ALTER COLUMN "flightDate" SET DATA TYPE SMALLINT;
21 changes: 11 additions & 10 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,11 @@ model AirportWeather {
status String
iconURL String
year Int
month Int
date Int
hour Int
year Int @db.SmallInt
month Int @db.SmallInt
date Int @db.SmallInt
hour Int @db.SmallInt
updatedAt DateTime @updatedAt
createdAt DateTime @default(now())
Expand Down Expand Up @@ -189,9 +190,9 @@ model Country {
model Flight {
id String @id @default(uuid())
flightYear Int
flightMonth Int
flightDate Int
flightYear Int @db.SmallInt
flightMonth Int @db.SmallInt
flightDate Int @db.SmallInt
airlineIata String
flightNumber String
Expand Down Expand Up @@ -320,9 +321,9 @@ model AircraftPosition {
latitude Float?
longitude Float?
altitude Float?
flightYear Int
flightMonth Int
flightDate Int
flightYear Int @db.SmallInt
flightMonth Int @db.SmallInt
flightDate Int @db.SmallInt
flightNumber String
airlineIata String
originIata String
Expand Down
18 changes: 18 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,23 @@ type AirportTsaWaitTime {
updatedAt: DateTimeISO!
}

type AirportWeather {
airTemperatureCelsius: Int!
airportIata: String!
createdAt: DateTimeISO!
date: Int!
hour: Int!
iconURL: String!
id: ID!
month: Int!
precipitationAmountMillimeter: Int!
status: String!
updatedAt: DateTimeISO!
windFromDirectionDegrees: Int!
windSpeedMeterPerSecond: Int!
year: Int!
}

enum CheckPointStatus {
CLOSE
OPEN
Expand Down Expand Up @@ -223,6 +240,7 @@ type Query {
airport(airportIata: String!): Airport!
airportTsaCheckpointsStatus(airportIata: String!, dayOfWeek: Float!): [AirportTsaCheckPointTerminal!]
airportTsaWaitTime(airportIata: String!): [AirportTsaWaitTime!]
airportWeather(airportIata: String!, date: Float!, hour: Float!, month: Float!, year: Float!): AirportWeather
flight(flightID: String!): Flight!
flightPromptness(flightID: String!): FlightPromptness!
flights(airlineIata: String!, date: Float!, flightNumber: String!, month: Float!, year: Float!): [Flight!]!
Expand Down
2 changes: 2 additions & 0 deletions src/api/graphql/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { createApolloContext } from './_context/create.context';
import { AircraftResolver } from './resolvers/aircraft.resolver';
import { UserFlightResolver } from './resolvers/user.flights.resolver';
import { UserPreferenceResolver } from './resolvers/user.preference.resolver';
import { AirportWeatherResolver } from './resolvers/airport.weather.resolver';
import { FlightPromptnessResolver } from './resolvers/flight.promptness.resolver';
import { AircraftPositionResolver } from './resolvers/aircraft.position.resolver';

Expand All @@ -37,6 +38,7 @@ const gqlSchema = await buildSchema({
FlightResolver,
FlightPromptnessResolver,
AirportResolver,
AirportWeatherResolver,
AirlineResolver,
AircraftResolver,
AircraftPositionResolver,
Expand Down

0 comments on commit ffda30e

Please sign in to comment.