2021-10-15 14:08:27 +00:00
|
|
|
from sqlalchemy import *
|
|
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from files.__main__ import Base
|
|
|
|
|
|
|
|
class UserBlock(Base):
|
|
|
|
|
|
|
|
__tablename__ = "userblocks"
|
2022-02-14 22:25:44 +00:00
|
|
|
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
|
|
|
target_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
2021-10-15 14:08:27 +00:00
|
|
|
|
|
|
|
user = relationship("User", primaryjoin="User.id==UserBlock.user_id", viewonly=True)
|
|
|
|
target = relationship("User", primaryjoin="User.id==UserBlock.target_id", viewonly=True)
|
|
|
|
|
|
|
|
def __repr__(self):
|
2021-10-09 07:21:22 +00:00
|
|
|
return f"<UserBlock(user={self.user_id}, target={self.target_id})>"
|