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
Copy file name to clipboardExpand all lines: docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/README.md
+25-1Lines changed: 25 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -119,6 +119,13 @@ Next up, let's add the nested fields to the marshmallow schemas.
119
119
The `TagAndItemSchema` will be used to return information about both the Item and Tag that have been modified in an endpoint, together with an informative message.
| <span style={{opacity: "50%"}}>✅ `GET`</span> | <span style={{opacity: "50%"}}>`/stores/{id}/tags`</span> | <span style={{opacity: "50%"}}>Get a list of tags in a store.</span> |
151
+
| <span style={{opacity: "50%"}}>✅ `POST`</span> | <span style={{opacity: "50%"}}>`/stores/{id}/tags`</span> | <span style={{opacity: "50%"}}>Create a new tag.</span> |
152
+
| ✅ `POST`|`/items/{id}/tags/{id}`| Link an item in a store with a tag from the same store. |
153
+
| ✅ `DELETE`|`/items/{id}/tags/{id}`| Unlink a tag from an item. |
154
+
| <span style={{opacity: "50%"}}>✅ `GET`</span> | <span style={{opacity: "50%"}}>`/tags/{id}`</span> | <span style={{opacity: "50%"}}>Get information about a tag given its unique id.</span> |
155
+
| ✅ `DELETE`|`/tags/{id}`| Delete a tag, which must have no associated items. |
156
+
157
+
Here's the code (new lines highlighted):
158
+
139
159
```python title="resources/tag.py"
140
160
from flask.views import MethodView
141
161
from flask_smorest import Blueprint, abort
@@ -242,4 +262,8 @@ class Tag(MethodView):
242
262
message="Could not delete tag. Make sure tag is not associated with any items, then try again.",
243
263
)
244
264
# highlight-end
245
-
```
265
+
```
266
+
267
+
And with that, we're done!
268
+
269
+
Now we're ready to look at securing API endpoints with user authentication.
0 commit comments