diff --git a/README.md b/README.md index 39e3f5c..624d624 100644 --- a/README.md +++ b/README.md @@ -8,23 +8,21 @@ 1. Morning Lab: Recreate Landscaper 1. Afternoon Lecture: [Intro to PHP 2](day1/instructor_notes/PHP2.md) 1. Afternoon Lab: Continue with Recreate Landscaper -1. Homework: Mimic Find/All with 2D arrays and nested objects +1. Homework: Mimic Find/All with 2D Arrays and Nested Objects ### Day 2 1. Morning Lecture: [PHP/Postgres API - READ](day2/instructor_notes/API.md) -1. Morning Lab: Update Lecture Code with READ for locations and companies +1. Morning Lab: Update Lecture Code with READ for Locations and Companies 1. Afternoon Lecture: [PHP/Postgres API - CREATE, UPDATE, DELETE](day2/instructor_notes/API2.md) -1. Afternoon Lab: Update Lecture Code with CREATE, UPDATE, DELETE on locations and companies -1. Homework: Finish with labs - - Stretch: Implement find for `/people/:id`, `/locations/:id`, and `/companies/:id` - - +1. Afternoon Lab: Update Lecture Code with CREATE, UPDATE, DELETE on Locations and Companies +1. Homework: Finish with Labs + - Stretch: Implement Find for `/people/:id`, `/locations/:id`, and `/companies/:id` ### Day 3 1. Morning Lecture: [Nested Models](day3/instructor_notes/Nested_Models.md) -1. Morning Lab: Implement find for both `/people/:id` and `/locations/:id` with nested models -1. Afternoon Lab (no lecture): Implement a many-to-many relation with a `Companies` model +1. Morning Lab: Implement Find for Both `/people/:id` and `/locations/:id` with Nested Models +1. Afternoon Lab (no lecture): Implement a Many-to-Many Relationship with a `Companies` Model - use a `jobs` intermediary table -1. Homework: Finish lab +1. Homework: Finish Lab diff --git a/day2/homework/README.md b/day2/homework/README.md new file mode 100644 index 0000000..df2a4d0 --- /dev/null +++ b/day2/homework/README.md @@ -0,0 +1,39 @@ +# Homework + +Finish [today's labs](../student_labs/) + +As a stretch, once the labs are complete, implement a show route (`find()`) for People (`/people/:id`), Locations (`/locations/:id`), Companies (`/companies/:id`). Each route should return JSON to the client for only the specified person, location, or company in the DB. For example, a call to `/locations/1` would return something like: + +```JSON +{ + "id":1, + "street":"123 Fake Street", + "city":"Awesometown", + "state":"CA" +} +``` + +This is different from the index route we wrote in lecture which returns all specified models in the DB in an array. For example: + +```JSON +[ + { + "id":1, + "street":"123 Fake Street", + "city":"Awesometown", + "state":"CA" + }, + { + "id":2, + "street":"456 Super Circle", + "city":"Funton", + "state":"NY" + }, + { + "id":3, + "street":"789 Radical Road", + "city":"Coolburg", + "state":"PA" + } +] +``` diff --git a/day2/student_labs/afternoon.md b/day2/student_labs/afternoon.md new file mode 100644 index 0000000..d32590f --- /dev/null +++ b/day2/student_labs/afternoon.md @@ -0,0 +1,3 @@ +# Afternoon Lab + +Finish [this morning's lab](morning.md). When complete, implement CREATE, UPDATE, and DELETE functionality on Locations. Once that's complete, implement CREATE, UPDATE, and DELETE functionality on Companies diff --git a/day2/student_labs/morning.md b/day2/student_labs/morning.md new file mode 100644 index 0000000..9da7892 --- /dev/null +++ b/day2/student_labs/morning.md @@ -0,0 +1,19 @@ +# Morning Lab + +Update your code from the lecture this morning so that it has READ (index) functionality for a `Locations` model. The model should have the following attributes (columns): + +1. id (SERIAL) +1. street (VARCHAR(32)) +1. city (VARCHAR(32)) +1. state (VARCHAR(2)) + +It's suggested that you have a php class `Location` that will represent each row in a table called `locations`. This is similar to the `Person` class from the lecture. You can create a "factory" class `Locations` that will be in charge of generating `Location` objects from the DB. This is similar to the `People` class from the lecture. + +If you finish this early, update your code so that it has READ (index) functionality for a `Companies` model. The model should have the following attributes (columns): + +1. id (SERIAL) +1. name (VARCHAR(32)) +1. website (VARCHAR(64)) +1. industry (VARCHAR(16)) + +It's suggested that you have a php class `Company` that will represent each row in a table called `companies`. This is similar to the `Person` class from the lecture. You can create a "factory" class `Companies` that will be in charge of generating `Company` objects from the DB. This is similar to the `People` class from the lecture.