Update code in endpoints/book.get.py
This commit is contained in:
parent
f4e51433c2
commit
0354afee4f
@ -0,0 +1,32 @@
|
|||||||
|
from fastapi import APIRouter, Depends, HTTPException
|
||||||
|
from core.database import fake_users_db
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
@router.get("/book")
|
||||||
|
async def book_handler():
|
||||||
|
"""Get book information demo endpoint"""
|
||||||
|
books = {
|
||||||
|
"1": {
|
||||||
|
"id": "1",
|
||||||
|
"title": "Demo Book 1",
|
||||||
|
"author": "John Doe",
|
||||||
|
"year": 2023
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"id": "2",
|
||||||
|
"title": "Demo Book 2",
|
||||||
|
"author": "Jane Smith",
|
||||||
|
"year": 2022
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
"message": "Books retrieved successfully",
|
||||||
|
"data": list(books.values()),
|
||||||
|
"metadata": {
|
||||||
|
"total_count": len(books),
|
||||||
|
"source": "demo_books_db",
|
||||||
|
"timestamp": "2024-01-01T00:00:00Z"
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user