-
Use express generator to create a
mongoose-flights
project. Be sure to install the node modules after you cd into the project. -
Create a config/database.js module that connects to a database named
flights
. Be sure to require the module in server.js. -
Create a
Flight
Model with the following properties:Property Type Validations Default Value airline
String
enum
to include 'American', 'Southwest' & 'United'n/a airport
String
enum
to include
'AUS', 'DFW', 'DEN', 'LAX' & 'SAN''DEN' flightNo
Number
Required
Between10
and9999
n/a departs
Date
n/a One year from date created -
Implement the following User Stories:
-
AAU, I want to view a list of all flights (index view) that displays each flight's airline, airport, flight no., and departure date/time.
-
AAU, I want to create flights by entering the information on a page (new view) that has a form and submitting it.
-
AAU, I want to be able to access each view via a navigation bar at the top of the page with links to:
ALL FLIGHTS
, andADD FLIGHT
-
-
Create a
destinationSchema
that will provide the structure for destination subdocuments that will be embedded:Property Type Validations Default Value airport
String
enum
to include
'AUS', 'DFW', 'DEN', 'LAX' & 'SAN'n/a arrival
Date
n/a n/a -
Add the following additional property to the
Flight
Model:Property Type Validations Default Value destinations
[destinationSchema]
n/a n/a -
Implement the following User Story:
AAU, when viewing the list of flights, I want to click on a "detail" link displayed next to each flight to view all of the properties for that flight (show
view), including each of its destinations. -
Implement the following User Story:
AAU, when viewing the details page (show
view) for a flight, I want to be able to add a destination for that flight. Each destination, as defined by the schema above, includes anarrival
date/time & one of the established airport codes._
Note: Multiple destinations are possible by adding them one at a time. -
Implement the following User Story:
AAU, when viewing the details page (show
view) for a flight, I want to see a list of that flight'sdestinations
(airport
&arrival
)
-
Create a
ticketSchema
that will be compiled into aTicket
Model with the following properties:Property Type Validations Default Value seat
String
Must be 'A1' thru 'F99' (see hints) n/a price
Number
Minimum of 0
n/a flight
ObjectId
Include ref: 'Flight'
to enable populationn/a