From 3377c366ad00e94f998ea3b4c666f8dc4b3da572 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Fri, 28 Mar 2025 09:41:20 +0000 Subject: [PATCH] Add GET endpoint for meals --- endpoints/meals.get.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 endpoints/meals.get.py diff --git a/endpoints/meals.get.py b/endpoints/meals.get.py new file mode 100644 index 0000000..550505d --- /dev/null +++ b/endpoints/meals.get.py @@ -0,0 +1,18 @@ +# Entity: Meal + +from fastapi import APIRouter, Depends, status +from sqlalchemy.orm import Session +from typing import List +from core.database import get_db +from models.meal import Meal +from schemas.meal import MealSchema +from helpers.meal_helpers import get_all_meals + +router = APIRouter() + +@router.get("/meals", status_code=200, response_model=List[MealSchema]) +async def get_meals( + db: Session = Depends(get_db) +): + meals = get_all_meals(db) + return meals \ No newline at end of file