19 lines
443 B
Python
19 lines
443 B
Python
|
from uuid import UUID
|
||
|
|
||
|
from sqlalchemy import ForeignKey
|
||
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||
|
|
||
|
from api.models import BaseModel
|
||
|
|
||
|
|
||
|
class RefersModel(BaseModel):
|
||
|
__tablename__ = "refers"
|
||
|
|
||
|
referer: Mapped[UUID] = mapped_column(ForeignKey("user.id"))
|
||
|
referals: Mapped[list["UserModel"]] = relationship(
|
||
|
"UserModel",
|
||
|
backref="refers",
|
||
|
lazy="selectin",
|
||
|
)
|
||
|
is_active: Mapped[bool]
|