From f7208ac25f84e790f1a9afb24e8edc741ac1b800 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Tue, 18 Mar 2025 16:04:13 +0000 Subject: [PATCH] Update code in endpoints/api/v1/endpoint.get.py --- endpoints/api/v1/endpoint.get.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 endpoints/api/v1/endpoint.get.py diff --git a/endpoints/api/v1/endpoint.get.py b/endpoints/api/v1/endpoint.get.py new file mode 100644 index 0000000..a8eceb2 --- /dev/null +++ b/endpoints/api/v1/endpoint.get.py @@ -0,0 +1,32 @@ +from fastapi import APIRouter, Depends, HTTPException +from core.database import fake_users_db +from typing import List, Dict + +router = APIRouter() + +@router.get("/books") +async def get_all_books(): + """Get all available books""" + books_db = { + "1": { + "id": "1", + "title": "Sample Book 1", + "author": "Author 1", + "published_year": 2023 + }, + "2": { + "id": "2", + "title": "Sample Book 2", + "author": "Author 2", + "published_year": 2022 + } + } + + return { + "message": "Books retrieved successfully", + "data": list(books_db.values()), + "metadata": { + "total_count": len(books_db), + "source": "demo_db" + } + } \ No newline at end of file