25 lines
659 B
Python
25 lines
659 B
Python
from datetime import date
|
|
from typing import Optional
|
|
|
|
from sqlalchemy.orm import mapped_column, Mapped, relationship
|
|
|
|
from app.database import Base
|
|
|
|
|
|
class Users(Base):
|
|
__tablename__ = "users"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True)
|
|
email: Mapped[str]
|
|
username: Mapped[str]
|
|
hashed_password: Mapped[str]
|
|
role: Mapped[int]
|
|
black_phoenix: Mapped[str]
|
|
avatar_image: Mapped[Optional[str]]
|
|
date_of_birth: Mapped[date]
|
|
|
|
message = relationship("Messages", back_populates="user")
|
|
usersxchats = relationship("UsersXChats", back_populates="user")
|
|
|
|
def __str__(self):
|
|
return f"Юзер {self.username}"
|