These clarifications and wireframes are meant to be a supplement to Mongoose Flights Lab, Part 2.
First, you're to create a Destination schema with the following fields/properties (and this schema should be embedded in the Flight schema, which should be updated to have a destinations
field/property):
airport
arrival
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.
In your flights/index.ejs
view, add a Details button that requests the show page for each flight:
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 an arrival date/time & one of the established airport codes. (Note: Multiple destinations are possible by adding them one at a time.)
Every destination must be related to one flight. So, on the show page, create a Destinations form whose inputs correspond to the Destination schema only. But, when that form is submitted, it should make a request that includes the flight's id.
AAU, when viewing the details page (show view) for a flight, I want to see a list of that flight's destinations (airport & arrival)
When the destinations are listed, the data for each row should only come from the Destination schema (in the same way that you accessed the Review schema in the Mongoose Movies lesson).
Both the Flight and Destination schema have an airport
field. The airport
field for the Flight should be used on the flights/index.ejs
view, the flights/new.ejs
view, and the top part of the flights/show.ejs
view. The airport
field for the Destination schema should be used in the Destinations form on the flights/show.ejs
view and in the list right below that form.
Remember that the styling is up to you.