19 lines
554 B
Python
19 lines
554 B
Python
# 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 |