Files
LibraryAPI/library_service/models/dto/book.py
wowlikon 6658d773bf Global refactoring of the project to use poetry and implement tests,
fixing bugs, changing the handling of dto and db models, preparing to
add new functionality
2025-06-24 13:30:35 +03:00

31 lines
624 B
Python

from sqlmodel import SQLModel
from pydantic import ConfigDict
from typing import Optional, List
class BookBase(SQLModel):
title: str
description: str
model_config = ConfigDict( #pyright: ignore
json_schema_extra={
"example": {
"title": "book_title",
"description": "book_description"
}
}
)
class BookCreate(BookBase):
pass
class BookUpdate(SQLModel):
title: Optional[str] = None
description: Optional[str] = None
class BookRead(BookBase):
id: int
class BookList(SQLModel):
books: List[BookRead]
total: int