18 lines
449 B
Python
18 lines
449 B
Python
# 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 models.dog import Dog
|
|
from schemas.dog import DogSchema
|
|
|
|
router = APIRouter()
|
|
|
|
@router.get("/dogs", status_code=200, response_model=List[DogSchema])
|
|
async def get_dogs(
|
|
db: Session = Depends(get_db)
|
|
):
|
|
"""Get all dogs"""
|
|
dogs = db.query(Dog).all()
|
|
return dogs |