You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Remove incorrect Wave_1 requirement from wave_01.md. Change primary keys for Task and Goal to be uid=501(kelseysteven) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),701(com.apple.sharepoint.group.1),33(_appstore),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),400(com.apple.access_remote_ae). Update project scaffold for flask changes. Update wave 1-5 docs for flask changes (more remain to update)
* Add info and screenshots to deployment doc about choosing the runtime
* Update requirements.txt
* Add requests package for sending Slack notification
* Update to_json to to_dict following what we use in class
* Remove mention of combined routes file
* Update ada-project-docs/optional-enhancements.md
* Update screenshots for setting language in Render
* Add red circle in first image showing where Language field is
* Updates for PR review to fix typos & be consistent with how we reference waves
* Apply suggestions from code review
Co-authored-by: Ashley Yang <ashley@adadevelopersacademy.org>
---------
Co-authored-by: Ashley Yang <ashley@adadevelopersacademy.org>
Copy file name to clipboardExpand all lines: ada-project-docs/setup.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ The goal for setup is to cover all of the set up needed at the beginning of this
9
9
1. Setting up development and test databases
10
10
1. Setting up a `.env` file
11
11
1. Running `$ flask db init`
12
-
1. Running `$ flask run` and `$ FLASK_ENV=development flask run`
12
+
1. Running `$ flask run` and `$ flask run --debug`
13
13
14
14
# Requirements
15
15
@@ -63,14 +63,14 @@ Run `$ flask db init`.
63
63
64
64
**_After you make your first model in Wave 1_**, run the other commands `migrate` and `upgrade`.
65
65
66
-
## Run `$ flask run` or `$ FLASK_ENV=development flask run`
66
+
## Run `$ flask run` or `$ flask run --debug`
67
67
68
68
Check that your Flask server can run with `$ flask run`.
69
69
70
70
We can run the Flask server specifying that we're working in the development environment. This enables hot-reloading, which is a feature that refreshes the Flask server every time there is a detected change.
71
71
72
72
```bash
73
-
$ FLASK_ENV=development flask run
73
+
$ flask run --debug
74
74
```
75
75
76
76
**It is highly recommended to run the Flask servers with this command**.
Copy file name to clipboardExpand all lines: ada-project-docs/wave_01.md
+25-33Lines changed: 25 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,25 +10,25 @@ Tasks are entities that describe a task a user wants to complete. They contain a
10
10
- description to hold details about the task
11
11
- an optional datetime that the task is completed on
12
12
13
-
Our goal for this wave is to be able to create, read, update, and delete different tasks. We will create RESTful routes for this different operations.
13
+
Our goal for this wave is to be able to create, read, update, and delete different tasks. We will create RESTful routes for these different operations.
14
14
15
15
# Requirements
16
16
17
17
## Task Model
18
18
19
19
There should be a `Task` model that lives in `app/models/task.py`.
20
20
21
-
Tasks should contain these attributes. Feel free to change the name of the `task_id` column if you would like. **The tests require the remaining columns to be named exactly** as `title`, `description`, and `completed_at`.
21
+
Tasks should contain these attributes. **The tests require the following columns to be named exactly** as `title`, `description`, and `completed_at`.
22
22
23
-
-`task_id`: a primary key for each task
23
+
-`id`: a primary key for each task
24
24
-`title`: text to name the task
25
25
-`description`: text to describe the task
26
-
-`completed_at`: a datetime that has the date that a task is completed on. **Can be _nullable_,** and contain a null value. A task with a `null` value for `completed_at` has not been completed. When we create a new task, `completed_at` should be `null` AKA `None` in Python.
26
+
-`completed_at`: a datetime that represents the date that a task is completed on. **Can be _nullable_,** and contain a null value. A task with a `null` value for `completed_at` has not been completed. When we create a new task, `completed_at` should be `null` AKA `None` in Python.
27
27
28
28
### Tips
29
29
30
-
-SQLAlchemy's column type for text is `db.String`. The column type for datetime is `db.DateTime`.
31
-
- SQLAlchemy supports _nullable_ columns with specific syntax.
30
+
-To work with date information, we can import the `datetime` data type with the import line `from datetime import datetime`.
31
+
- SQLAlchemy supports optional, or _nullable_, columns with specific syntax.
32
32
- Don't forget to run:
33
33
-`flask db init` once during setup
34
34
-`flask db migrate` every time there's a change in models, in order to generate migrations
@@ -38,8 +38,6 @@ Tasks should contain these attributes. Feel free to change the name of the `task
38
38
39
39
## CRUD for Tasks
40
40
41
-
The following are required routes for wave 1. Feel free to implement the routes in any order within this wave.
42
-
43
41
### Tips
44
42
45
43
- Pay attention to the exact shape of the expected JSON. Double-check nested data structures and the names of the keys for any mispellings.
@@ -52,9 +50,15 @@ The following are required routes for wave 1. Feel free to implement the routes
52
50
53
51
### CLI
54
52
55
-
In addition to testing your code with pytest and postman, you can play test your code with the CLI (Command Line Interface) by running `python3 cli/main.py`. The flask server needs to be running to run the CLI.
53
+
In addition to testing your code with pytest and postman, you can play test your code with the CLI (Command Line Interface) by running `python3 cli/main.py`.
54
+
55
+
The flask server needs to be running first before running the CLI.
56
+
57
+
### CRUD Routes
56
58
57
-
### Create a Task: Valid Task With `null``completed_at`
59
+
The following are required routes for wave 1. Feel free to implement the routes in any order within this wave.
60
+
61
+
#### Create a Task: Valid Task With `null``completed_at`
58
62
59
63
As a client, I want to be able to make a `POST` request to `/tasks` with the following HTTP request body
60
64
@@ -83,7 +87,7 @@ and get this response:
83
87
84
88
so that I know I successfully created a Task that is saved in the database.
85
89
86
-
### Get Tasks: Getting Saved Tasks
90
+
####Get Tasks: Getting Saved Tasks
87
91
88
92
As a client, I want to be able to make a `GET` request to `/tasks` when there is at least one saved task and get this response:
89
93
@@ -106,7 +110,7 @@ As a client, I want to be able to make a `GET` request to `/tasks` when there is
106
110
]
107
111
```
108
112
109
-
### Get Tasks: No Saved Tasks
113
+
####Get Tasks: No Saved Tasks
110
114
111
115
As a client, I want to be able to make a `GET` request to `/tasks` when there are zero saved tasks and get this response:
112
116
@@ -116,7 +120,7 @@ As a client, I want to be able to make a `GET` request to `/tasks` when there ar
116
120
[]
117
121
```
118
122
119
-
### Get One Task: One Saved Task
123
+
####Get One Task: One Saved Task
120
124
121
125
As a client, I want to be able to make a `GET` request to `/tasks/1` when there is at least one saved task and get this response:
122
126
@@ -133,7 +137,7 @@ As a client, I want to be able to make a `GET` request to `/tasks/1` when there
133
137
}
134
138
```
135
139
136
-
### Update Task
140
+
####Update Task
137
141
138
142
As a client, I want to be able to make a `PUT` request to `/tasks/1` when there is at least one saved task with this request body:
139
143
@@ -159,9 +163,9 @@ and get this response:
159
163
}
160
164
```
161
165
162
-
Note that the update endpoint does update the `completed_at` attribute. This will be updated with custom endpoints implemented in Wave 03.
166
+
Note that the update endpoint does update the `completed_at` attribute. This will be updated with custom endpoints implemented in Wave 3.
163
167
164
-
### Delete Task: Deleting a Task
168
+
####Delete Task: Deleting a Task
165
169
166
170
As a client, I want to be able to make a `DELETE` request to `/tasks/1` when there is at least one saved task and get this response:
167
171
@@ -173,15 +177,15 @@ As a client, I want to be able to make a `DELETE` request to `/tasks/1` when the
173
177
}
174
178
```
175
179
176
-
### No matching Task: Get, Update, and Delete
180
+
####No Matching Task: Get, Update, and Delete
177
181
178
182
As a client, if I make any of the following requests:
179
183
180
184
*`GET``/tasks/<task_id>`
181
185
*`UPDATE``/tasks/<task_id>`
182
186
*`DELETE``/tasks/<task_id>`
183
187
184
-
and there is no existing task with `task_id`
188
+
and there is no existing task with an `id` of `task_id`
185
189
186
190
The response code should be `404`.
187
191
@@ -190,9 +194,9 @@ You may choose the response body.
190
194
Make sure to complete the tests for non-existing tasks to check that the correct response body is returned.
191
195
192
196
193
-
### Create a Task: Invalid Task With Missing Data
197
+
####Create a Task: Invalid Task With Missing Data
194
198
195
-
#### Missing `title`
199
+
#####Missing `title`
196
200
197
201
As a client, I want to be able to make a `POST` request to `/tasks` with the following HTTP request body
198
202
@@ -215,7 +219,7 @@ and get this response:
215
219
216
220
so that I know I did not create a Task that is saved in the database.
217
221
218
-
#### Missing `description`
222
+
#####Missing `description`
219
223
220
224
If the HTTP request is missing `description`, we should also get this response:
221
225
@@ -226,15 +230,3 @@ If the HTTP request is missing `description`, we should also get this response:
226
230
"details": "Invalid data"
227
231
}
228
232
```
229
-
230
-
#### Missing `completed_at`
231
-
232
-
If the HTTP request is missing `completed_at`, we should also get this response:
Copy file name to clipboardExpand all lines: ada-project-docs/wave_05.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ This wave requires more test writing.
18
18
- These tests are currently skipped with `@pytest.mark.skip(reason="test to be completed by student")` and the function body has `pass` in it. Once you implement these tests you should remove the `skip` decorator and the `pass`.
19
19
- For the tests you write, use the requirements in this document to guide your test writing.
20
20
- Pay attention to the exact shape of the expected JSON. Double-check nested data structures and the names of the keys for any mispellings.
21
-
- You can model your tests off of the Wave 01 tests for Tasks.
21
+
- You can model your tests off of the Wave 1 tests for Tasks.
22
22
- Some tests use a [fixture](https://docs.pytest.org/en/6.2.x/fixture.html) named `one_goal` that is defined in `tests/conftest.py`. This fixture saves a specific goal to the test database.
23
23
24
24
@@ -28,9 +28,9 @@ This wave requires more test writing.
28
28
29
29
There should be a `Goal` model that lives in `app/models/goal.py`.
30
30
31
-
Goals should contain these attributes. Feel free to change the name of the `goal_id` column if you would like. **The tests require the title column to be named exactly** as `title`.
31
+
Goals should contain these attributes. **The tests require the title column to be named exactly** as `title`.
Copy file name to clipboardExpand all lines: ada-project-docs/wave_06.md
+4-10Lines changed: 4 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,32 +16,26 @@ Secondly, we should create our new route, `/goals/<goal_id>/tasks`, so that our
16
16
17
17
### Tips
18
18
19
-
- Use independent research to discover how to set up a one-to-many relationship in Flask.
19
+
- Use lesson materials and independent research to review how to set up a one-to-many relationship in Flask.
20
20
- Remember to run `flask db migrate` and `flask db upgrade` whenever there is a change to the model.
21
21
- Pay attention to the exact shape of the expected JSON. Double-check nested data structures and the names of the keys for any mispellings.
22
22
- Use the tests in `tests/test_wave_06.py` to guide your implementation.
23
23
- Some tests use a fixture named `one_task_belongs_to_one_goal` that is defined in `tests/conftest.py`. This fixture saves a task and a goal to the test database, and uses SQLAlchemy to associate the goal and task together.
24
24
25
25
### Updates to the Goal Model
26
26
27
-
Use independent research to discover how to set up a one-to-many relationship in Flask.
28
-
29
27
The Goal model should have a _relationship_ with the model Task.
30
28
31
-
After learning the strategy for creating a one-to-many relationship, in the Goal model, we recommend:
32
-
33
-
- Setting the `lazy` value to `True`
29
+
After reviewing the strategy for creating a one-to-many relationship, it is up to you if you would like to add convenience attributes for accessing the `Goal` model from it's related `Task`s and vice versa, accessing the list of associated `Task`s from a `Goal` model.
34
30
35
31
### Updates to the Task Model
36
32
37
-
Use independent research to discover how to set up a one-to-many relationship in Flask.
38
-
39
33
The Task model should belong to one `Goal`.
40
34
41
-
After learning the strategy for creating a one-to-many relationship, in the Task model, we recommend:
35
+
After reviewing the strategy for creating a one-to-many relationship, in the Task model, we recommend:
42
36
43
37
- Setting the foreign key to `goal`'s primary key column
44
-
-Setting the `nullable`to `True`
38
+
-Using `Optional` syntax to make the attribute nullable
45
39
46
40
Remember to run `flask db migrate` and `flask db upgrade` whenever there is a change to the model.
Copy file name to clipboardExpand all lines: ada-project-docs/wave_07.md
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,15 @@ Our goal is to make our project accessible online!
8
8
9
9
Deploy this project to Render.
10
10
11
-
Then, add some Task records and Goal records to the production database.
11
+
When deploying a web service to Render, it will try to be helpful and set the `Language` field for you, but it doesn't always select the correct option.
12
+
13
+

14
+
15
+
Our language for this project should be `Python 3`, which you can select from a drop down if needed by clicking on the current value of the `Language` field.
16
+
17
+

18
+
19
+
Once deployed, add some Task records and Goal records to the production database.
12
20
13
21
Be sure to grab the URL of your deployed app. It will be submitted at the time of project submission.
0 commit comments