feat: Add Book schemas

This commit is contained in:
Backend IM Bot 2025-04-11 09:35:01 +00:00
parent beb2a9d40f
commit dc8fe6b7c8

25
schemas/book.py Normal file
View File

@ -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