feat: integrated pally webhook (draft, needs rewrite)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import BIGINT, TEXT, VARCHAR
|
||||
from sqlalchemy import BIGINT, INTEGER, REAL, TEXT, VARCHAR, ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from db.base import Base
|
||||
@@ -13,10 +13,17 @@ class User(Base):
|
||||
__tablename__ = "users"
|
||||
|
||||
id: Mapped[int] = mapped_column(
|
||||
BIGINT, unique=True, autoincrement=True, nullable=False, primary_key=True
|
||||
INTEGER, unique=True, autoincrement=True, nullable=False, primary_key=True
|
||||
)
|
||||
username: Mapped[str] = mapped_column(TEXT, unique=True, nullable=True)
|
||||
hashed_password: Mapped[str] = mapped_column(VARCHAR(255), nullable=True)
|
||||
telegram_id: Mapped[int] = mapped_column(BIGINT, unique=True, nullable=True)
|
||||
referal_id: Mapped[int] = mapped_column(ForeignKey("users.id"), nullable=True)
|
||||
|
||||
balance: Mapped[float] = mapped_column(REAL, nullable=False, default=0)
|
||||
|
||||
sessions: Mapped[list["Session"]] = relationship(back_populates="user", lazy="selectin")
|
||||
referal: Mapped["User | None"] = relationship(
|
||||
"User",
|
||||
remote_side=[id],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user