Форматирование кода, добавление лого, исправление тестов, улучшение эндпоинтов и документации

This commit is contained in:
2025-11-30 20:03:39 +03:00
parent a3ccd8a466
commit 99de648fa9
38 changed files with 1261 additions and 308 deletions

View File

@@ -1,19 +1,22 @@
from .author import (
AuthorBase, AuthorCreate, AuthorUpdate,
AuthorRead, AuthorList
)
from .book import (
BookBase, BookCreate, BookUpdate,
BookRead, BookList
)
from .author import AuthorBase, AuthorCreate, AuthorUpdate, AuthorRead, AuthorList
from .book import BookBase, BookCreate, BookUpdate, BookRead, BookList
from .genre import (
GenreBase, GenreCreate, GenreUpdate,
GenreRead, GenreList
)
from .genre import GenreBase, GenreCreate, GenreUpdate, GenreRead, GenreList
__all__ = [
'AuthorBase', 'AuthorCreate', 'AuthorUpdate', 'AuthorRead', 'AuthorList',
'BookBase', 'BookCreate', 'BookUpdate', 'BookRead', 'BookList',
'GenreBase', 'GenreCreate', 'GenreUpdate', 'GenreRead', 'GenreList',
"AuthorBase",
"AuthorCreate",
"AuthorUpdate",
"AuthorRead",
"AuthorList",
"BookBase",
"BookCreate",
"BookUpdate",
"BookRead",
"BookList",
"GenreBase",
"GenreCreate",
"GenreUpdate",
"GenreRead",
"GenreList",
]

View File

@@ -2,24 +2,27 @@ from sqlmodel import SQLModel
from pydantic import ConfigDict
from typing import Optional, List
class AuthorBase(SQLModel):
name: str
model_config = ConfigDict( #pyright: ignore
json_schema_extra={
"example": {"name": "author_name"}
}
model_config = ConfigDict( # pyright: ignore
json_schema_extra={"example": {"name": "author_name"}}
)
class AuthorCreate(AuthorBase):
pass
class AuthorUpdate(SQLModel):
name: Optional[str] = None
class AuthorRead(AuthorBase):
id: int
class AuthorList(SQLModel):
authors: List[AuthorRead]
total: int

View File

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

View File

@@ -2,24 +2,27 @@ from sqlmodel import SQLModel
from pydantic import ConfigDict
from typing import Optional, List
class GenreBase(SQLModel):
name: str
model_config = ConfigDict( #pyright: ignore
json_schema_extra={
"example": {"name": "genre_name"}
}
model_config = ConfigDict( # pyright: ignore
json_schema_extra={"example": {"name": "genre_name"}}
)
class GenreCreate(GenreBase):
pass
class GenreUpdate(SQLModel):
name: Optional[str] = None
class GenreRead(GenreBase):
id: int
class GenreList(SQLModel):
genres: List[GenreRead]
total: int