Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save micahwierenga/d09e20357288506b38e8c25a98a8efb9 to your computer and use it in GitHub Desktop.
Save micahwierenga/d09e20357288506b38e8c25a98a8efb9 to your computer and use it in GitHub Desktop.

Mongoose Flights Lab, Part 2: Supplement

These clarifications and wireframes are meant to be a supplement to Mongoose Flights Lab, Part 2.

The Destination Schema

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

User Stories

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:

Mongoose Flights Lab flights/index.ejs with details


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.

Mongoose Flights Lab flights/show.ejs with no destinations


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.

Mongoose Flights Lab flights/show.ejs with destinations

Remember that the styling is up to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment