From 4e528f862a00157410c8a9f8d5ae030815874c2d Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Sat, 12 Apr 2025 21:32:24 +0000 Subject: [PATCH] feat: Updated endpoint endpoints/names.post.py via AI --- endpoints/names.post.py | 9 +++++---- helpers/fruit_helpers.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/endpoints/names.post.py b/endpoints/names.post.py index a93e836..b475e1c 100644 --- a/endpoints/names.post.py +++ b/endpoints/names.post.py @@ -1,11 +1,12 @@ -from fastapi import APIRouter, status +from fastapi import APIRouter from typing import List +from schemas.fruit import FruitNamesResponse from helpers.fruit_helpers import get_all_fruit_names router = APIRouter() -@router.post("/names", status_code=status.HTTP_200_OK, response_model=List[str]) -async def get_names(): - """Return all fruit names""" +@router.post("/names", status_code=200, response_model=List[FruitNamesResponse]) +async def get_fruit_names(): + """Get all fruit names""" fruit_names = get_all_fruit_names() return fruit_names \ No newline at end of file diff --git a/helpers/fruit_helpers.py b/helpers/fruit_helpers.py index 60338b2..4042841 100644 --- a/helpers/fruit_helpers.py +++ b/helpers/fruit_helpers.py @@ -47,7 +47,7 @@ def get_fruit_by_name(db: Session, name: str) -> Optional[Fruit]: def get_all_fruit_names(db: Session) -> List[str]: """ Retrieves a list of all fruit names. - This is the preferred method for getting fruit names. + Note: This method is deprecated in favor of get_all_fruits() which returns complete fruit objects. Args: db (Session): The database session.