Add GET endpoint for /planets

This commit is contained in:
Backend IM Bot 2025-03-25 13:05:05 -05:00
parent 9b38518d5b
commit 3aaf881c0b

14
endpoints/planets.get.py Normal file
View File

@ -0,0 +1,14 @@
# Entity: Planet
from fastapi import APIRouter, Depends, HTTPException, status
from sqlalchemy.orm import Session
from app.api.db.database import get_db
router = APIRouter()
@router.get("/planets", response_model=List[PlanetSchema])
async def get_planets(
db: Session = Depends(get_db)
):
planets = db.query(Planet).all()
return planets