Skip to content

Commit 84bc1b4

Browse files
authored
Merge pull request #79 from tecladocode/jose/add-store-id-check-many-to-many
2 parents fb75146 + da8a508 commit 84bc1b4

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)