From 0d0cdcaec2274c428b13d53980723518a63d9fe7 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Tue, 25 Mar 2025 23:20:42 +0000 Subject: [PATCH] Add Book schema --- schemas/book.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/schemas/book.py b/schemas/book.py index 4e6d3cd..bae9775 100644 --- a/schemas/book.py +++ b/schemas/book.py @@ -6,8 +6,11 @@ class BookBase(BaseModel): title: str = Field(..., min_length=1, max_length=200, description="Book title") description: Optional[str] = Field(None, description="Book description") isbn: str = Field(..., description="Book ISBN number") - publication_year: int = Field(..., ge=1000, le=9999, description="Year of publication") author_id: str = Field(..., description="ID of the book's author") + publication_year: int = Field(..., ge=1000, le=2100, description="Year of publication") + pages: int = Field(..., gt=0, description="Number of pages") + genre: str = Field(..., description="Book genre") + publisher: str = Field(..., description="Book publisher") class BookCreate(BookBase): class Config: @@ -16,8 +19,11 @@ class BookCreate(BookBase): "title": "The Great Gatsby", "description": "A novel by F. Scott Fitzgerald", "isbn": "978-0743273565", + "author_id": "author_uuid", "publication_year": 1925, - "author_id": "author_uuid_here" + "pages": 180, + "genre": "Fiction", + "publisher": "Scribner" } } @@ -32,7 +38,10 @@ class Book(BookBase): "title": "The Great Gatsby", "description": "A novel by F. Scott Fitzgerald", "isbn": "978-0743273565", + "author_id": "author_uuid", "publication_year": 1925, - "author_id": "author_uuid_here" + "pages": 180, + "genre": "Fiction", + "publisher": "Scribner" } } \ No newline at end of file