Add GET endpoint for /trees

This commit is contained in:
Backend IM Bot 2025-03-25 13:12:16 -05:00
parent 38dfe42087
commit 5e59b61c8b

12
endpoints/trees.get.py Normal file
View File

@ -0,0 +1,12 @@
# Entity: Tree
from fastapi import APIRouter, Depends
from sqlalchemy.orm import Session
from app.api.db.database import get_db
router = APIRouter()
@router.get("/trees", status_code=200, response_model=List[TreeSchema])
async def get_trees(db: Session = Depends(get_db)):
trees = db.query(Tree).all()
return trees