add migrations, create domain and crud layers

This commit is contained in:
2026-10-26 21:59:40 +03:00
parent 76b34fca4b
commit 3082b84f61
27 changed files with 481 additions and 278 deletions
+1 -1
View File
@@ -3,4 +3,4 @@ from app.schemas.message import Message
from app.schemas.session import AuthSession
from app.schemas.user import User
__all__ = ["User", "Chat", "Message", "AuthSession"]
__all__ = ["AuthSession", "Chat", "Message", "User"]
+2 -1
View File
@@ -1,5 +1,6 @@
from uuid import UUID
from datetime import datetime
from uuid import UUID
from pydantic import Field
from app.schemas.base import Base, BaseCreate, BasePage
+1
View File
@@ -1,5 +1,6 @@
from datetime import datetime
from uuid import UUID
from pydantic import Field
from app.schemas.base import Base, BaseCreate, BasePage
+6 -2
View File
@@ -4,6 +4,9 @@ from pydantic import Field
from app.schemas.base import Base, BaseCreate
PASSWORD_MIN_LENGTH = 12
PASSWORD_MAX_LENGTH = 128
class User(Base):
"""Публичное представление пользователя. Пароль/хеш сюда не попадают никогда."""
@@ -16,5 +19,6 @@ class User(Base):
class CreateUser(BaseCreate):
username: str = Field(pattern=r"^[a-z0-9_]{3,32}$")
display_name: str = Field(min_length=1, max_length=100)
# 12-128 Unicode code points (pydantic считает именно code points).
password: str = Field(min_length=12, max_length=128, repr=False)
password: str = Field(
min_length=PASSWORD_MIN_LENGTH, max_length=PASSWORD_MAX_LENGTH, repr=False
)