Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix(Item Update): Fix ItemUpdateSchema by adding store_id #157

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
```
Loading