introduce the database and controller connections for all inbounds

This commit is contained in:
Sven Czarnian
2022-10-23 16:58:00 +02:00
parent 7a41dd0fb2
commit f69e365623
19 changed files with 849 additions and 4 deletions

View File

@@ -0,0 +1,42 @@
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';
export type AircraftDocument = Aircraft & Document;
@Schema()
export class Aircraft {
@Prop({
required: true,
type: String,
})
type: string;
@Prop({
required: true,
type: String,
enum: ['L', 'M', 'H', 'S'],
})
wtc: string;
@Prop({
required: true,
type: String,
enum: ['A', 'B', 'C', 'D', 'E', 'F'],
})
wakeRecat: string;
@Prop({
required: true,
type: Number,
})
engineCount: number;
@Prop({
required: true,
type: String,
enum: ['ELECTRIC', 'TURBOPROP', 'JET'],
})
engineType: string;
}
export const AircraftSchema = SchemaFactory.createForClass(Aircraft);

View File

@@ -0,0 +1,32 @@
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';
import { Waypoint, WaypointSchema } from 'src/generic/models/waypoint.model';
export type ControllerInputDocument = ControllerInput & Document;
@Schema()
export class ControllerInput {
@Prop({
type: String,
})
reportedTime: string;
@Prop({
required: true,
type: [WaypointSchema],
})
remainingRoute: Waypoint[];
@Prop({
type: String,
})
requestedRunway: string;
@Prop({
type: String,
})
plannedStand: string;
}
export const ControllerInputSchema =
SchemaFactory.createForClass(ControllerInput);

View File

@@ -0,0 +1,43 @@
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';
import {
Coordinate,
CoordinateSchema,
} from '../../generic/models/coordinate.model';
export type FlightStateDocument = FlightState & Document;
@Schema()
export class FlightState {
@Prop({
required: true,
type: CoordinateSchema,
})
position: Coordinate;
@Prop({
required: true,
type: Number,
})
groundSpeed: number;
@Prop({
required: true,
type: Number,
})
groundTrack: number;
@Prop({
required: true,
type: Number,
})
altitude: number;
@Prop({
required: true,
type: Number,
})
verticalSpeed: number;
}
export const FlightStateSchema = SchemaFactory.createForClass(FlightState);

View File

@@ -0,0 +1,59 @@
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';
import { Aircraft, AircraftSchema } from './aircraft.model';
import {
ControllerInput,
ControllerInputSchema,
} from './controllerinput.model';
import { FlightState, FlightStateSchema } from './flightstate.model';
import { Planning, PlanningSchema } from './planning.model';
export type InboundDocument = Inbound & Document;
@Schema()
export class Inbound {
@Prop({
required: true,
index: true,
type: String,
})
callsign: string;
@Prop({
required: true,
index: true,
type: String,
})
destination: string;
@Prop({
required: true,
type: String,
enum: ['UNK', 'DEL', 'GRD', 'TWR', 'APP', 'DEP', 'CTR'],
})
reporter: string;
@Prop({
required: true,
type: AircraftSchema,
})
aircraft: Aircraft;
@Prop({
required: true,
type: FlightStateSchema,
})
flightState: FlightState;
@Prop({
type: ControllerInputSchema,
})
controllerData: ControllerInput;
@Prop({
type: PlanningSchema,
})
plan: Planning;
}
export const InboundSchema = SchemaFactory.createForClass(Inbound);

View File

@@ -0,0 +1,37 @@
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';
import {
PredictedWaypoint,
PredictedWaypointSchema,
} from './predictedwaypoint.model';
export type PlanningDocument = Planning & Document;
@Schema()
export class Planning {
@Prop({
required: true,
type: String,
})
arrivalRoute: string;
@Prop({
required: true,
type: String,
})
arrivalRunway: string;
@Prop({
required: true,
type: [PredictedWaypointSchema],
})
plannedRoute: PredictedWaypoint[];
@Prop({
required: true,
type: Boolean,
})
fixedPlan: boolean;
}
export const PlanningSchema = SchemaFactory.createForClass(Planning);

View File

@@ -0,0 +1,41 @@
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';
import { Waypoint, WaypointSchema } from '../../generic/models/waypoint.model';
export type PredictedWaypointDocument = PredictedWaypoint & Document;
@Schema()
export class PredictedWaypoint {
@Prop({
required: true,
type: WaypointSchema,
})
waypoint: Waypoint;
@Prop({
required: true,
type: Number,
})
altitude: number;
@Prop({
required: true,
type: Number,
})
indicatedAirspeed: number;
@Prop({
required: true,
type: Number,
})
groundspeed: number;
@Prop({
required: true,
type: String,
})
plannedOverheadTime: string;
}
export const PredictedWaypointSchema =
SchemaFactory.createForClass(PredictedWaypoint);