feat: Updated endpoint endpoints/names.post.py via AI
This commit is contained in:
parent
244bfcaed1
commit
63f6676eac
@ -1,13 +1,14 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy.orm import Session
|
||||
from typing import List
|
||||
from core.database import get_db
|
||||
from helpers.fruit_helpers import get_all_fruit_names
|
||||
from fastapi import APIRouter
|
||||
from fastapi.responses import JSONResponse
|
||||
from helpers.fruit_helpers import get_all_fruits
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.post("/names", status_code=200, response_model=List[str])
|
||||
async def get_fruit_names(db: Session = Depends(get_db)):
|
||||
"""Get all fruit names"""
|
||||
names = get_all_fruit_names(db)
|
||||
return names
|
||||
@router.post("/names")
|
||||
async def update_route_description():
|
||||
"""get all fruits with joy!"""
|
||||
fruits = get_all_fruits()
|
||||
return JSONResponse(
|
||||
status_code=200,
|
||||
content={"message": "Route description updated", "fruits": fruits}
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user