Add GET endpoint for /planets
This commit is contained in:
parent
9b38518d5b
commit
3aaf881c0b
14
endpoints/planets.get.py
Normal file
14
endpoints/planets.get.py
Normal 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
|
Loading…
x
Reference in New Issue
Block a user