Skip to content

Commit da8a508

Browse files
committed
docs(sqlalchemy): add checking item and tag have same store
1 parent fb75146 commit da8a508

File tree

1 file changed

+11
-0
lines changed
  • docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships

1 file changed

+11
-0
lines changed

docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,4 +275,15 @@ class Tag(MethodView):
275275

276276
And with that, we're done!
277277

278+
## Making sure Store ID matches when linking tags
279+
280+
If you wanted to, you can make sure that you can only link a tag that belongs to a certain store, with an item of that same store.
281+
282+
Something like this would work:
283+
284+
```py
285+
if item.store.id != tag.store.id:
286+
abort(400, message="Make sure item and tag belong to the same store before linking.")
287+
```
288+
278289
Now we're ready to look at securing API endpoints with user authentication.

0 commit comments

Comments
 (0)