From 72a6253d9a1e759eb8ee566f7828f851a6048071 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Wed, 30 Apr 2025 09:45:58 +0000 Subject: [PATCH] feat: add GET endpoint for retrieving all fruits --- endpoints/fruits.get.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/endpoints/fruits.get.py b/endpoints/fruits.get.py index e69de29..6f2b8c2 100644 --- a/endpoints/fruits.get.py +++ b/endpoints/fruits.get.py @@ -0,0 +1,13 @@ +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 \ No newline at end of file