14 lines
363 B
Python
14 lines
363 B
Python
from fastapi import APIRouter, Depends
|
|
from models.book import Book
|
|
from schemas.book import BookCreate
|
|
from helpers.book_helpers import create_book
|
|
|
|
router = APIRouter()
|
|
|
|
@router.post("/tk", status_code=201)
|
|
async def generate_book(
|
|
book_data: BookCreate = Depends(),
|
|
db: Session = Depends(get_db)
|
|
):
|
|
book = create_book(db, book_data)
|
|
return book |