Add GET endpoint for food

This commit is contained in:
Backend IM Bot 2025-03-28 13:53:07 +00:00
parent 0f63f2ddc2
commit 9f94b744b2

15
endpoints/food.get.py Normal file
View File

@ -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