Skip to content

Commit

Permalink
Merge pull request tecladocode#157 from tecladocode/jose/cou-332-fix-…
Browse files Browse the repository at this point in the history
…code-mismatch-between-lecture-video-ebook-and-github

🐛 fix(Item Update): Fix `ItemUpdateSchema` by adding `store_id`
  • Loading branch information
jslvtr authored Apr 5, 2024
2 parents 2fd689b + 19366be commit 6fcf0cc
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,24 @@ def put(self, item_data, item_id):
return item
# highlight-end
```

Our `ItemUpdateSchema` at the moment looks like this:

```python title="schemas.py"
class ItemUpdateSchema(Schema):
name = fields.Str()
price = fields.Float()
```

But since now our update endpoint may create items, we need to change the schema to optionally accept a `store_id`.

When updating an item, `name` or `price` (or both) may be passed, but when creating an item, `name`, `price`, and `store_id` must be passed.

Update the `ItemUpdateSchema` to this:

```python title="schemas.py"
class ItemUpdateSchema(Schema):
name = fields.Str()
price = fields.Float()
store_id = fields.Int()
```

0 comments on commit 6fcf0cc

Please sign in to comment.