Add GET endpoint for /lol
This commit is contained in:
parent
053386be3f
commit
74d93ee1b8
18
endpoints/lol.get.py
Normal file
18
endpoints/lol.get.py
Normal 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 models.dog import Dog
|
||||||
|
from schemas.dog import DogSchema
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
@router.get("/lol", 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
|
Loading…
x
Reference in New Issue
Block a user