Add GET endpoint for /countries
This commit is contained in:
parent
2d5d779013
commit
344c76f6b5
12
endpoints/countries.get.py
Normal file
12
endpoints/countries.get.py
Normal file
@ -0,0 +1,12 @@
|
||||
# Entity: Country
|
||||
|
||||
from fastapi import APIRouter, Depends, status
|
||||
from sqlalchemy.orm import Session
|
||||
from core.database import get_db
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.get("/countries", status_code=status.HTTP_200_OK, response_model=List[CountrySchema])
|
||||
async def get_countries(db: Session = Depends(get_db)):
|
||||
countries = db.query(Country).all()
|
||||
return countries
|
Loading…
x
Reference in New Issue
Block a user