From dc8fe6b7c8dd5c03f9b48d00873cf141c083a5bc Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Fri, 11 Apr 2025 09:35:01 +0000 Subject: [PATCH] feat: Add Book schemas --- schemas/book.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 schemas/book.py diff --git a/schemas/book.py b/schemas/book.py new file mode 100644 index 0000000..b9fdeda --- /dev/null +++ b/schemas/book.py @@ -0,0 +1,25 @@ +from pydantic import BaseModel, Field +from typing import Optional +from datetime import datetime +from uuid import UUID + +class BookBase(BaseModel): + title: str = Field(..., description="Title of the book") + author: str = Field(..., description="Author of the book") + description: Optional[str] = Field(None, description="Description of the book") + publisher: Optional[str] = Field(None, description="Publisher of the book") + publication_year: Optional[int] = Field(None, description="Year of publication") + isbn: str = Field(..., description="ISBN of the book") + pages: Optional[int] = Field(None, description="Number of pages") + language: Optional[str] = Field(None, description="Language of the book") + +class BookCreate(BookBase): + pass + +class BookSchema(BookBase): + id: UUID + created_at: datetime + updated_at: datetime + + class Config: + orm_mode = True \ No newline at end of file