This commit is contained in:
Aevann1 2021-09-17 14:36:39 +02:00
parent 7887014474
commit 11c1bbd203
11 changed files with 55 additions and 116 deletions

View file

@ -28,12 +28,7 @@ class Comment(Base, Age_times, Scores, Stndrd, Fuzzing):
__tablename__ = "comments"
id = Column(Integer, primary_key=True)
comment_aux = relationship(
"CommentAux",
lazy="joined",
uselist=False,
innerjoin=True,
primaryjoin="Comment.id==CommentAux.id")
comment_aux = relationship("CommentAux", lazy="joined", uselist=False, innerjoin=True, primaryjoin="Comment.id==CommentAux.id", viewonly=True)
author_id = Column(Integer, ForeignKey("users.id"))
parent_submission = Column(Integer, ForeignKey("submissions.id"))
# this column is foreignkeyed to comment(id) but we can't do that yet as
@ -55,23 +50,19 @@ class Comment(Base, Age_times, Scores, Stndrd, Fuzzing):
sentto=Column(Integer)
app_id = Column(Integer, ForeignKey("oauth_apps.id"))
oauth_app=relationship("OauthApp")
oauth_app=relationship("OauthApp", viewonly=True)
post = relationship("Submission")
flags = relationship("CommentFlag", lazy="dynamic")
author = relationship(
"User",
lazy="joined",
innerjoin=True,
primaryjoin="User.id==Comment.author_id")
post = relationship("Submission", viewonly=True)
flags = relationship("CommentFlag", lazy="dynamic", viewonly=True)
author = relationship("User", lazy="joined", innerjoin=True, primaryjoin="User.id==Comment.author_id", viewonly=True)
upvotes = Column(Integer, default=1)
downvotes = Column(Integer, default=0)
parent_comment = relationship("Comment", remote_side=[id])
child_comments = relationship("Comment", remote_side=[parent_comment_id])
parent_comment = relationship("Comment", remote_side=[id], viewonly=True)
child_comments = relationship("Comment", remote_side=[parent_comment_id], viewonly=True)
awards = relationship("AwardRelationship", lazy="joined")
awards = relationship("AwardRelationship", lazy="joined", viewonly=True)
def __init__(self, *args, **kwargs):
@ -344,8 +335,8 @@ class Notification(Base):
blocksender = Column(Integer)
unblocksender = Column(Integer)
comment = relationship("Comment", lazy="joined", innerjoin=True)
user=relationship("User", innerjoin=True)
comment = relationship("Comment", lazy="joined", innerjoin=True, viewonly=True)
user=relationship("User", innerjoin=True, viewonly=True)
def __repr__(self):