foodapp-jhvlko/endpoints/meals.get.py
2025-03-27 12:19:20 +01:00

18 lines
466 B
Python

# 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