13 lines
430 B
Python
13 lines
430 B
Python
from fastapi import APIRouter, Depends
|
|
from typing import List
|
|
from sqlalchemy.orm import Session
|
|
from core.database import get_db
|
|
from schemas.fruit import FruitSchema
|
|
from helpers.fruit_helpers import get_all_fruits
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/fruits", status_code=200, response_model=List[FruitSchema])
|
|
async def get_all_fruits_endpoint(db: Session = Depends(get_db)):
|
|
fruits = get_all_fruits(db)
|
|
return fruits |