15 lines
466 B
Python
15 lines
466 B
Python
from fastapi import APIRouter, Depends
|
|
from typing import Dict
|
|
from helpers.fruit_helpers import update_fruit
|
|
from schemas.fruit import FruitSchema
|
|
from db import get_db, Session
|
|
|
|
router = APIRouter()
|
|
|
|
@router.put("/fruits", response_model=Dict[str, FruitSchema])
|
|
async def update_fruit_endpoint(
|
|
fruit_update: FruitSchema,
|
|
db: Session = Depends(get_db)
|
|
):
|
|
updated_fruit = update_fruit(db=db, fruit_update=fruit_update)
|
|
return {"data": updated_fruit} |