14 lines
414 B
Python
14 lines
414 B
Python
import asyncpg
|
|
from dishka.integrations.fastapi import DishkaRoute, FromDishka
|
|
from fastapi import APIRouter
|
|
|
|
from utils.read import accounts
|
|
from utils.read.models import AccountView
|
|
|
|
router = APIRouter(prefix="/api", tags=["accounts"], route_class=DishkaRoute)
|
|
|
|
|
|
@router.get("/accounts")
|
|
async def list_accounts(pool: FromDishka[asyncpg.Pool]) -> list[AccountView]:
|
|
return await accounts.list_accounts(pool)
|