feat: Updated endpoint endpoints/fruits.get.py via AI
This commit is contained in:
parent
728d305a42
commit
0cefccc0c9
@ -2,11 +2,13 @@ from fastapi import APIRouter, Depends
|
|||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
from typing import List
|
from typing import List
|
||||||
from core.database import get_db
|
from core.database import get_db
|
||||||
|
from schemas.fruit import FruitSchema
|
||||||
from helpers.fruit_helpers import get_all_fruits
|
from helpers.fruit_helpers import get_all_fruits
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
@router.get("/fruits", response_model=List[str])
|
@router.get("/fruits", response_model=List[FruitSchema])
|
||||||
async def get_fruit_names(db: Session = Depends(get_db)):
|
async def get_fruits(db: Session = Depends(get_db)):
|
||||||
|
"""Get all fruits"""
|
||||||
fruits = get_all_fruits(db)
|
fruits = get_all_fruits(db)
|
||||||
return [fruit.name for fruit in fruits]
|
return fruits
|
Loading…
x
Reference in New Issue
Block a user