Add GET endpoint for food
This commit is contained in:
parent
0f63f2ddc2
commit
9f94b744b2
15
endpoints/food.get.py
Normal file
15
endpoints/food.get.py
Normal 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
|
Loading…
x
Reference in New Issue
Block a user