Add GET endpoint for dogs
This commit is contained in:
parent
63ca344754
commit
059307560c
18
endpoints/dogs.get.py
Normal file
18
endpoints/dogs.get.py
Normal 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
|
Loading…
x
Reference in New Issue
Block a user