Update code in endpoints/trees.get.py

This commit is contained in:
Backend IM Bot 2025-03-28 18:32:23 +00:00
parent 10d1ee859d
commit 1dab350708

View File

@ -8,15 +8,10 @@ from helpers.tree_helpers import get_all_trees
router = APIRouter()
@router.get("/trees", response_model=List[TreeSchema], status_code=status.HTTP_200_OK)
@router.get("/trees", status_code=200, response_model=List[TreeSchema])
async def get_trees(
db: Session = Depends(get_db)
):
"""Get all trees"""
trees = get_all_trees(db)
if not trees:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail="No trees found"
)
return trees