Update code in endpoints/food.get.py

This commit is contained in:
Backend IM Bot 2025-03-28 17:58:19 +00:00
parent 70b2fe183b
commit 91756496cc

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

@ -0,0 +1,17 @@
from fastapi import APIRouter, Depends, HTTPException, status
from sqlalchemy.orm import Session
from typing import List
from core.database import get_db
from models.food import Food
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)
):
"""Get all foods"""
foods = get_all_foods(db)
return foods