From 9f94b744b2a3b743bca636a116fc886407021d33 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Fri, 28 Mar 2025 13:53:07 +0000 Subject: [PATCH] Add GET endpoint for food --- endpoints/food.get.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 endpoints/food.get.py diff --git a/endpoints/food.get.py b/endpoints/food.get.py new file mode 100644 index 0000000..352798e --- /dev/null +++ b/endpoints/food.get.py @@ -0,0 +1,15 @@ +# Entity: Food + +from fastapi import APIRouter, Depends +from typing import List +from schemas.food import FoodSchema +from helpers.food_helpers import get_all_foods + +router = APIRouter() + +@router.get("/food", status_code=200, response_model=List[FoodSchema]) +async def get_foods( + db: Session = Depends(get_db) +): + foods = get_all_foods(db) + return foods \ No newline at end of file