Add GET endpoint for /birds
This commit is contained in:
parent
e4a863bef3
commit
2dad31ee49
18
endpoints/birds.get.py
Normal file
18
endpoints/birds.get.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Entity: Bird
|
||||
|
||||
from fastapi import APIRouter, Depends, status
|
||||
from typing import List
|
||||
from core.database import get_db
|
||||
from sqlalchemy.orm import Session
|
||||
from models.bird import Bird
|
||||
from schemas.bird import BirdSchema
|
||||
from helpers.bird_helpers import get_all_birds
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.get("/birds", status_code=200, response_model=List[BirdSchema])
|
||||
async def get_birds(
|
||||
db: Session = Depends(get_db)
|
||||
):
|
||||
birds = get_all_birds(db)
|
||||
return birds
|
Loading…
x
Reference in New Issue
Block a user