Skip to content

Commit c6a4a8e

Browse files
committed
adds recommendations for helper methods on the nested routes
1 parent 4d937df commit c6a4a8e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ada-project-docs/wave_06.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ Then the three `Task`s belong to the `Goal` and it gets updated in the database,
6363
}
6464
```
6565

66+
We will need to validate that the Goal ID, as well as each Task ID exists in the database. A route helper method that can resolve a model instance from its ID would help us validate the IDs in the request body.
67+
6668
### Getting Tasks of One Goal
6769

6870
Given a goal that has:
@@ -100,6 +102,10 @@ then I get this response:
100102
}
101103
```
102104

105+
Notice that if we have been using a model helper method to return a dictionary representation of a Task, we can use this method to help build this route response. However, we must notice that there is an additional key in the data for the Task models that are associated with the Goal. This doesn't necessarily mean that we should abandon the model helper method, but we may need to introduce logic to allow it to work in this context.
106+
107+
This is also true of the Goal model helper method. We may need to introduce logic to allow it to work in this context, or use the existing method to generate the basic dictionary representation of the Goal and then add the additional data for the associated Task models.
108+
103109
### Getting Tasks of One Goal: No Matching Tasks
104110

105111
Given a goal that has:

0 commit comments

Comments
 (0)