sync
This commit is contained in:
@@ -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,
|
||||
)
|
||||
|
Reference in New Issue
Block a user