from fastapi import APIRouter, Depends, HTTPException from core.database import fake_users_db import uuid router = APIRouter() @router.post("/gdt-book") async def create_gdt_book( title: str, author: str, description: str = "", category: str = "general" ): """Create a new GDT book entry""" book_id = str(uuid.uuid4()) if title.strip() == "": raise HTTPException(status_code=400, detail="Title cannot be empty") new_book = { "id": book_id, "title": title, "author": author, "description": description, "category": category, "created_at": "2024-01-01T00:00:00Z", # Demo timestamp "status": "active" } # Store in demo database if "books" not in fake_users_db: fake_users_db["books"] = {} fake_users_db["books"][book_id] = new_book return { "message": "GDT book created successfully", "book_id": book_id, "data": new_book, "metadata": { "created_timestamp": "2024-01-01T00:00:00Z", "version": "1.0" } }