2021-07-21 01:12:26 +00:00
|
|
|
from sqlalchemy import *
|
|
|
|
from sqlalchemy.orm import relationship
|
2021-07-22 19:19:49 +00:00
|
|
|
from drama.__main__ import Base
|
2021-07-21 01:12:26 +00:00
|
|
|
from .mix_ins import *
|
|
|
|
|
|
|
|
class Flag(Base, Stndrd):
|
|
|
|
|
|
|
|
__tablename__ = "flags"
|
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True)
|
|
|
|
post_id = Column(Integer, ForeignKey("submissions.id"))
|
|
|
|
user_id = Column(Integer, ForeignKey("users.id"))
|
2021-07-25 23:49:53 +00:00
|
|
|
reason = Column(String(100))
|
2021-07-21 01:12:26 +00:00
|
|
|
created_utc = Column(Integer)
|
|
|
|
|
|
|
|
user = relationship("User", lazy = "joined", primaryjoin = "Flag.user_id == User.id", uselist = False)
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
|
|
|
|
return f"<Flag(id={self.id})>"
|
|
|
|
|
|
|
|
|
|
|
|
class CommentFlag(Base, Stndrd):
|
|
|
|
|
|
|
|
__tablename__ = "commentflags"
|
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True)
|
|
|
|
user_id = Column(Integer, ForeignKey("users.id"))
|
|
|
|
comment_id = Column(Integer, ForeignKey("comments.id"))
|
2021-07-25 23:49:53 +00:00
|
|
|
reason = Column(String(100))
|
2021-07-21 01:12:26 +00:00
|
|
|
created_utc = Column(Integer)
|
|
|
|
|
|
|
|
user = relationship("User", lazy = "joined", primaryjoin = "CommentFlag.user_id == User.id", uselist = False)
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
|
|
|
|
return f"<CommentFlag(id={self.id})>"
|
|
|
|
|
|
|
|
|
|
|
|
class Report(Base):
|
|
|
|
|
|
|
|
__tablename__ = "reports"
|
|
|
|
|
|
|
|
id = Column(Integer, primary_key=True)
|
|
|
|
post_id = Column(Integer, ForeignKey("submissions.id"))
|
|
|
|
user_id = Column(Integer, ForeignKey("users.id"))
|
|
|
|
created_utc = Column(Integer)
|
|
|
|
|
|
|
|
user = relationship("User", lazy = "joined", primaryjoin = "Report.user_id == User.id", uselist = False)
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
|
|
|
|
return f"<Report(id={self.id})>"
|