diff --git a/endpoints/food.post.py b/endpoints/food.post.py new file mode 100644 index 0000000..0be2e30 --- /dev/null +++ b/endpoints/food.post.py @@ -0,0 +1,19 @@ +# Entity: Food + +from fastapi import APIRouter, Depends, 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, FoodCreate +from helpers.food_helpers import create_foods + +router = APIRouter() + +@router.post("/food", status_code=201, response_model=List[FoodSchema]) +async def add_foods( + foods: List[FoodCreate], + db: Session = Depends(get_db) +): + created_foods = create_foods(db, foods) + return created_foods \ No newline at end of file