🚚 Re-sort tutorial example files

This commit is contained in:
Sebastián Ramírez
2018-12-13 21:25:45 +04:00
parent 8eaae72b76
commit a47243d915
71 changed files with 656 additions and 656 deletions

View File

@@ -10,6 +10,10 @@ class Item(BaseModel):
app = FastAPI()
@app.put("/items/{item_id}")
async def create_item(item_id: int, item: Item):
return {"item_id": item_id, **item.dict()}
@app.post("/items/")
async def create_item(item: Item):
item_dict = item.dict()
if item.tax:
price_with_tax = item.price + item.tax
item_dict.update({"price_with_tax": price_with_tax})
return item_dict