This commit is contained in:
2024-03-12 01:06:43 +03:00
parent fb7e64f738
commit 2adfaecabd
10 changed files with 65 additions and 65 deletions

View File

@@ -1,7 +1,4 @@
from sqlalchemy import Boolean, Column, String
from sqlalchemy.orm import Mapped
from api.schemas import UserReadDTO
from sqlalchemy.orm import Mapped, mapped_column
from . import Base
@@ -9,10 +6,15 @@ from . import Base
class UserModel(Base):
__tablename__ = "users"
name: Mapped[str]
email = Column(String, unique=True)
hashed_password = Column(String)
is_active = Column(Boolean, default=True)
first_name: Mapped[str]
mid_name: Mapped[str]
last_name: Mapped[str]
email: Mapped[str] = mapped_column(unique=True)
telegram_id: Mapped[str] = mapped_column(unique=True)
hashed_password: Mapped[str]
is_active: Mapped[bool] = mapped_column(default=False)
def __repr__(self):
return (
@@ -21,9 +23,3 @@ class UserModel(Base):
f'hashed_password="{self.hashed_password}", '
f"is_active={self.is_active})>"
)
def to_read_model(self) -> UserReadDTO:
return UserReadDTO(
id=self.id,
name=self.name,
)