mirror of
https://github.com/wowlikon/LibraryAPI.git
synced 2025-12-11 21:30:46 +00:00
Форматирование кода, добавление лого, исправление тестов, улучшение эндпоинтов и документации
This commit is contained in:
@@ -2,29 +2,31 @@ 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
|
||||
model_config = ConfigDict( # pyright: ignore
|
||||
json_schema_extra={
|
||||
"example": {
|
||||
"title": "book_title",
|
||||
"description": "book_description"
|
||||
}
|
||||
"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
|
||||
|
||||
Reference in New Issue
Block a user