mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2026-01-17 11:40:39 +03:00
add filter on relation example
This commit is contained in:
15
the_app/api/shakespeare.py
Normal file
15
the_app/api/shakespeare.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from fastapi import APIRouter, Depends, status
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from the_app.database import get_db
|
||||
from the_app.models.shakespeare import Paragraph
|
||||
|
||||
router = APIRouter(prefix="/v1/shakespeare")
|
||||
|
||||
|
||||
@router.get("/",)
|
||||
async def find_paragraph(
|
||||
character: str,
|
||||
db_session: AsyncSession = Depends(get_db),
|
||||
):
|
||||
return await Paragraph.find(db_session=db_session, character=character)
|
||||
Reference in New Issue
Block a user