Add GET endpoint for menu
This commit is contained in:
parent
dd783802c1
commit
4d20babd38
18
endpoints/menu.get.py
Normal file
18
endpoints/menu.get.py
Normal file
@ -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("/menu", status_code=200, response_model=List[MealSchema])
|
||||
async def get_menu(
|
||||
db: Session = Depends(get_db)
|
||||
):
|
||||
meals = get_all_meals(db)
|
||||
return meals
|
Loading…
x
Reference in New Issue
Block a user