Files
malenia/db/models/users.py
hexdev 0ed0ad2b92 Add referral system and user balance tracking
Introduce balance field to User model with Alembic migration. Add
referral menu, admin /refpay command, and deep link sharing. Update
Dockerfile to multi-stage build and add Postgres service to compose.
Fix deep link parsing logic and conditional proxy initialization.
2026-04-10 22:20:53 +07:00

16 lines
503 B
Python

from sqlalchemy import BIGINT, INTEGER, TEXT
from sqlalchemy.orm import Mapped, mapped_column
from db.base import Base
class User(Base):
__tablename__ = "users"
id: Mapped[int] = mapped_column(
BIGINT, nullable=False, unique=True, primary_key=True
)
referal_id: Mapped[int] = mapped_column(BIGINT, nullable=True)
subscription_link: Mapped[str] = mapped_column(TEXT, nullable=True, unique=True)
balance: Mapped[int] = mapped_column(INTEGER, nullable=False, default=0)