Add GET endpoint for /dogs

This commit is contained in:
Backend IM Bot 2025-03-26 12:47:42 +00:00
parent 8032633b89
commit cf7fa54448

View File

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