2021-07-21 01:12:26 +00:00
|
|
|
from sqlalchemy import *
|
|
|
|
from sqlalchemy.orm import relationship
|
2021-08-04 15:35:10 +00:00
|
|
|
from files.__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
|
|
|
|
2021-09-17 12:36:39 +00:00
|
|
|
user = relationship("User", lazy = "joined", primaryjoin = "Flag.user_id == User.id", uselist = False, viewonly=True)
|
2021-07-21 01:12:26 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2021-09-17 12:36:39 +00:00
|
|
|
user = relationship("User", lazy = "joined", primaryjoin = "CommentFlag.user_id == User.id", uselist = False, viewonly=True)
|
2021-07-21 01:12:26 +00:00
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
|
|
|
|
return f"<CommentFlag(id={self.id})>"
|