Add GET endpoint for dogs

This commit is contained in:
Backend IM Bot 2025-03-26 21:06:32 +01:00
parent 63ca344754
commit 059307560c

18
endpoints/dogs.get.py Normal file
View File

@ -0,0 +1,18 @@
# Entity: Dog
from fastapi import APIRouter, Depends, status
from sqlalchemy.orm import Session
from typing import List
from core.database import get_db
from models.dog import Dog
from schemas.dog import DogSchema
from helpers.dog_helpers import get_all_dogs
router = APIRouter()
@router.get("/dogs", status_code=200, response_model=List[DogSchema])
async def get_dogs(
db: Session = Depends(get_db)
):
dogs = get_all_dogs(db)
return dogs