Add GET endpoint for /newendpoint

This commit is contained in:
Backend IM Bot 2025-03-27 16:15:50 +00:00
parent aade11ebc5
commit 2fb7dae215

View File

@ -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