Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions api/routes/books.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,11 @@ async def delete_book(book_id: int) -> None:


@router.get("/{book_id}", response_model=Book, status_code=status.HTTP_200_OK)
async def get_book(book_id: int):
async def get_book(book_id: int) -> Book:
book = db.get_book(book_id)

if not book:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail=f"Book with ID {book_id} does not exist"
detail="Book not found"
)

return book
return book