Add GET endpoint for /newendpoint
This commit is contained in:
parent
aade11ebc5
commit
2fb7dae215
@ -0,0 +1,19 @@
|
||||
# Entity: Country
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
from sqlalchemy.orm import Session
|
||||
from typing import List
|
||||
from core.database import get_db
|
||||
from models.country import Country
|
||||
from schemas.country import CountrySchema
|
||||
from helpers.country_helpers import get_all_countries
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.get("/countries", response_model=List[CountrySchema], status_code=200)
|
||||
async def get_countries(
|
||||
db: Session = Depends(get_db)
|
||||
):
|
||||
"""Get all countries"""
|
||||
countries = get_all_countries(db)
|
||||
return countries
|
Loading…
x
Reference in New Issue
Block a user