Update code in endpoints/endpoint.get.py
This commit is contained in:
parent
43fb2d85f0
commit
0d935f479f
@ -0,0 +1,17 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
from sqlalchemy.orm import Session
|
||||
from typing import List
|
||||
from core.database import get_db
|
||||
from models.fruit import Fruit
|
||||
from schemas.fruit import FruitSchema, FruitCreate
|
||||
from helpers.fruit_helpers import create_fruit
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.post("/fruits", status_code=201, response_model=FruitSchema)
|
||||
async def create_fruit_entry(
|
||||
fruit_data: FruitCreate,
|
||||
db: Session = Depends(get_db)
|
||||
):
|
||||
new_fruit = create_fruit(db, fruit_data)
|
||||
return new_fruit
|
Loading…
x
Reference in New Issue
Block a user