mirror of
https://github.com/flibusta-apps/book_library_server.git
synced 2025-12-06 15:15:36 +01:00
Add linters configs
This commit is contained in:
@@ -3,30 +3,32 @@ from fastapi import APIRouter, Depends, HTTPException, status
|
||||
from fastapi_pagination import Params, Page
|
||||
from fastapi_pagination.ext.ormar import paginate
|
||||
|
||||
from app.models import BookAnnotation as BookAnnotationDB
|
||||
from app.serializers.book_annotation import BookAnnotation, CreateBookAnnotation, UpdateBookAnnotation
|
||||
from app.depends import check_token
|
||||
from app.models import BookAnnotation as BookAnnotationDB
|
||||
from app.serializers.book_annotation import (
|
||||
BookAnnotation,
|
||||
CreateBookAnnotation,
|
||||
UpdateBookAnnotation,
|
||||
)
|
||||
|
||||
|
||||
book_annotation_router = APIRouter(
|
||||
prefix="/api/v1/book_annotations",
|
||||
tags=["book_annotation"],
|
||||
dependencies=[Depends(check_token)]
|
||||
dependencies=[Depends(check_token)],
|
||||
)
|
||||
|
||||
|
||||
@book_annotation_router.get("/", response_model=Page[BookAnnotation], dependencies=[Depends(Params)])
|
||||
@book_annotation_router.get(
|
||||
"/", response_model=Page[BookAnnotation], dependencies=[Depends(Params)]
|
||||
)
|
||||
async def get_book_annotations():
|
||||
return await paginate(
|
||||
BookAnnotationDB.objects
|
||||
)
|
||||
return await paginate(BookAnnotationDB.objects)
|
||||
|
||||
|
||||
@book_annotation_router.post("/", response_model=BookAnnotation)
|
||||
async def create_book_annotation(data: CreateBookAnnotation):
|
||||
return await BookAnnotationDB.objects.create(
|
||||
**data.dict()
|
||||
)
|
||||
return await BookAnnotationDB.objects.create(**data.dict())
|
||||
|
||||
|
||||
@book_annotation_router.get("/{id}", response_model=BookAnnotation)
|
||||
|
||||
Reference in New Issue
Block a user