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