mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2025-12-06 15:15:36 +01:00
22 lines
614 B
Python
22 lines
614 B
Python
from fastapi import APIRouter, Depends
|
|
|
|
from fastapi_pagination import Page, Params
|
|
from fastapi_pagination.ext.ormar import paginate
|
|
|
|
from app.depends import check_token
|
|
from app.models import Source as SourceDB
|
|
from app.serializers.source import Source
|
|
from app.utils.transformer import dict_transformer
|
|
|
|
|
|
source_router = APIRouter(
|
|
prefix="/api/v1/sources",
|
|
tags=["source"],
|
|
dependencies=[Depends(check_token)],
|
|
)
|
|
|
|
|
|
@source_router.get("", response_model=Page[Source], dependencies=[Depends(Params)])
|
|
async def get_sources():
|
|
return await paginate(SourceDB.objects, transformer=dict_transformer)
|