Merge branch 'frost' of https://github.com/Aevann1/rDrama into frost

master
Aevann1 2022-09-19 20:13:37 +00:00
commit 0d7a34d966
29 changed files with 41 additions and 197 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 448 KiB

View File

@ -8,11 +8,7 @@ class Alt(Base):
user1 = Column(Integer, ForeignKey("users.id"), primary_key=True) user1 = Column(Integer, ForeignKey("users.id"), primary_key=True)
user2 = Column(Integer, ForeignKey("users.id"), primary_key=True) user2 = Column(Integer, ForeignKey("users.id"), primary_key=True)
is_manual = Column(Boolean, default=False) is_manual = Column(Boolean, default=False)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):

View File

@ -16,16 +16,12 @@ class AwardRelationship(Base):
kind = Column(String) kind = Column(String)
awarded_utc = Column(Integer) awarded_utc = Column(Integer)
granted = Column(Boolean) granted = Column(Boolean)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
user = relationship("User", primaryjoin="AwardRelationship.user_id==User.id", back_populates="awards") user = relationship("User", primaryjoin="AwardRelationship.user_id==User.id", back_populates="awards")
post = relationship("Submission", primaryjoin="AwardRelationship.submission_id==Submission.id", back_populates="awards") post = relationship("Submission", primaryjoin="AwardRelationship.submission_id==Submission.id", back_populates="awards")
comment = relationship("Comment", primaryjoin="AwardRelationship.comment_id==Comment.id", back_populates="awards") comment = relationship("Comment", primaryjoin="AwardRelationship.comment_id==Comment.id", back_populates="awards")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<AwardRelationship(id={self.id})>" return f"<AwardRelationship(id={self.id})>"

View File

@ -11,11 +11,7 @@ class BadgeDef(Base):
id = Column(Integer, primary_key=True, autoincrement=True) id = Column(Integer, primary_key=True, autoincrement=True)
name = Column(String) name = Column(String)
description = Column(String) description = Column(String)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<BadgeDef(id={self.id})>" return f"<BadgeDef(id={self.id})>"
@ -34,16 +30,11 @@ class Badge(Base):
badge_id = Column(Integer, ForeignKey('badge_defs.id'), primary_key=True) badge_id = Column(Integer, ForeignKey('badge_defs.id'), primary_key=True)
description = Column(String) description = Column(String)
url = Column(String) url = Column(String)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
user = relationship("User", back_populates="badges") user = relationship("User", back_populates="badges")
badge = relationship("BadgeDef", primaryjoin="Badge.badge_id == BadgeDef.id") badge = relationship("BadgeDef", primaryjoin="Badge.badge_id == BadgeDef.id")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs:
kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<Badge(user_id={self.user_id}, badge_id={self.badge_id})>" return f"<Badge(user_id={self.user_id}, badge_id={self.badge_id})>"

View File

@ -8,7 +8,7 @@ class Casino_Game(Base):
id = Column(Integer, primary_key=True) id = Column(Integer, primary_key=True)
user_id = Column(Integer, ForeignKey("users.id")) user_id = Column(Integer, ForeignKey("users.id"))
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
active = Column(Boolean, default=True) active = Column(Boolean, default=True)
currency = Column(String) currency = Column(String)
wager = Column(Integer) wager = Column(Integer)
@ -16,10 +16,5 @@ class Casino_Game(Base):
kind = Column(String) kind = Column(String)
game_state = Column(JSON) game_state = Column(JSON)
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs:
kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<CasinoGame(id={self.id})>" return f"<CasinoGame(id={self.id})>"

View File

@ -18,14 +18,10 @@ class OauthApp(Base):
redirect_uri = Column(String) redirect_uri = Column(String)
description = Column(String) description = Column(String)
author_id = Column(Integer, ForeignKey("users.id")) author_id = Column(Integer, ForeignKey("users.id"))
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
author = relationship("User", back_populates="apps") author = relationship("User", back_populates="apps")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<OauthApp(id={self.id})>" return f"<OauthApp(id={self.id})>"
@ -66,14 +62,10 @@ class ClientAuth(Base):
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True) user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
oauth_client = Column(Integer, ForeignKey("oauth_apps.id"), primary_key=True) oauth_client = Column(Integer, ForeignKey("oauth_apps.id"), primary_key=True)
access_token = Column(String) access_token = Column(String)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
user = relationship("User") user = relationship("User")
application = relationship("OauthApp") application = relationship("OauthApp")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<ClientAuth(user_id={self.user_id}, oauth_client={self.oauth_client})>" return f"<ClientAuth(user_id={self.user_id}, oauth_client={self.oauth_client})>"

View File

@ -37,7 +37,7 @@ class Comment(Base):
id = Column(Integer, primary_key=True) id = Column(Integer, primary_key=True)
author_id = Column(Integer, ForeignKey("users.id")) author_id = Column(Integer, ForeignKey("users.id"))
parent_submission = Column(Integer, ForeignKey("submissions.id")) parent_submission = Column(Integer, ForeignKey("submissions.id"))
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
edited_utc = Column(Integer, default=0) edited_utc = Column(Integer, default=0)
is_banned = Column(Boolean, default=False) is_banned = Column(Boolean, default=False)
ghost = Column(Boolean, default=False) ghost = Column(Boolean, default=False)
@ -73,13 +73,7 @@ class Comment(Base):
flags = relationship("CommentFlag", order_by="CommentFlag.created_utc") flags = relationship("CommentFlag", order_by="CommentFlag.created_utc")
options = relationship("CommentOption", order_by="CommentOption.id") options = relationship("CommentOption", order_by="CommentOption.id")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs:
kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<Comment(id={self.id})>" return f"<Comment(id={self.id})>"
@lazy @lazy

View File

@ -7,11 +7,7 @@ class BannedDomain(Base):
__tablename__ = "banneddomains" __tablename__ = "banneddomains"
domain = Column(String, primary_key=True) domain = Column(String, primary_key=True)
reason = Column(String) reason = Column(String)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<BannedDomain(domain={self.domain})>" return f"<BannedDomain(domain={self.domain})>"

View File

@ -9,13 +9,9 @@ class Exile(Base):
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True) user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
sub = Column(String, ForeignKey("subs.name"), primary_key=True) sub = Column(String, ForeignKey("subs.name"), primary_key=True)
exiler_id = Column(Integer, ForeignKey("users.id")) exiler_id = Column(Integer, ForeignKey("users.id"))
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
exiler = relationship("User", primaryjoin="User.id==Exile.exiler_id") exiler = relationship("User", primaryjoin="User.id==Exile.exiler_id")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<Exile(user_id={self.user_id}, sub={self.sub})>" return f"<Exile(user_id={self.user_id}, sub={self.sub})>"

View File

@ -13,14 +13,10 @@ class Flag(Base):
post_id = Column(Integer, ForeignKey("submissions.id"), primary_key=True) post_id = Column(Integer, ForeignKey("submissions.id"), primary_key=True)
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True) user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
reason = Column(String) reason = Column(String)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
user = relationship("User", primaryjoin = "Flag.user_id == User.id", uselist = False) user = relationship("User", primaryjoin = "Flag.user_id == User.id", uselist = False)
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<Flag(user_id={self.user_id}, post_id={self.post_id})>" return f"<Flag(user_id={self.user_id}, post_id={self.post_id})>"
@ -36,14 +32,10 @@ class CommentFlag(Base):
comment_id = Column(Integer, ForeignKey("comments.id"), primary_key=True) comment_id = Column(Integer, ForeignKey("comments.id"), primary_key=True)
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True) user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
reason = Column(String) reason = Column(String)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
user = relationship("User", primaryjoin = "CommentFlag.user_id == User.id", uselist = False) user = relationship("User", primaryjoin = "CommentFlag.user_id == User.id", uselist = False)
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<CommentFlag(user_id={self.user_id}, comment_id={self.comment_id})>" return f"<CommentFlag(user_id={self.user_id}, comment_id={self.comment_id})>"

View File

@ -7,14 +7,10 @@ class Follow(Base):
__tablename__ = "follows" __tablename__ = "follows"
target_id = Column(Integer, ForeignKey("users.id"), primary_key=True) target_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True) user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
user = relationship("User", uselist=False, primaryjoin="User.id==Follow.user_id", back_populates="following") user = relationship("User", uselist=False, primaryjoin="User.id==Follow.user_id", back_populates="following")
target = relationship("User", uselist=False, primaryjoin="User.id==Follow.target_id", back_populates="followers") target = relationship("User", uselist=False, primaryjoin="User.id==Follow.target_id", back_populates="followers")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<Follow(id={self.id})>" return f"<Follow(id={self.id})>"

View File

@ -15,15 +15,11 @@ class HatDef(Base):
author_id = Column(Integer, ForeignKey('users.id')) author_id = Column(Integer, ForeignKey('users.id'))
price = Column(Integer) price = Column(Integer)
submitter_id = Column(Integer, ForeignKey("users.id")) submitter_id = Column(Integer, ForeignKey("users.id"))
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
author = relationship("User", primaryjoin="HatDef.author_id == User.id", back_populates="designed_hats") author = relationship("User", primaryjoin="HatDef.author_id == User.id", back_populates="designed_hats")
submitter = relationship("User", primaryjoin="HatDef.submitter_id == User.id") submitter = relationship("User", primaryjoin="HatDef.submitter_id == User.id")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<HatDef(id={self.id})>" return f"<HatDef(id={self.id})>"
@ -42,15 +38,11 @@ class Hat(Base):
user_id = Column(Integer, ForeignKey('users.id'), primary_key=True) user_id = Column(Integer, ForeignKey('users.id'), primary_key=True)
hat_id = Column(Integer, ForeignKey('hat_defs.id'), primary_key=True) hat_id = Column(Integer, ForeignKey('hat_defs.id'), primary_key=True)
equipped = Column(Boolean, default=False) equipped = Column(Boolean, default=False)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
hat_def = relationship("HatDef") hat_def = relationship("HatDef")
owners = relationship("User", back_populates="owned_hats") owners = relationship("User", back_populates="owned_hats")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<Hat(user_id={self.user_id}, hat_id={self.hat_id})>" return f"<Hat(user_id={self.user_id}, hat_id={self.hat_id})>"

View File

@ -13,11 +13,7 @@ class Lottery(Base):
prize = Column(Integer, default=0) prize = Column(Integer, default=0)
tickets_sold = Column(Integer, default=0) tickets_sold = Column(Integer, default=0)
winner_id = Column(Integer, ForeignKey("users.id")) winner_id = Column(Integer, ForeignKey("users.id"))
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<Lottery(id={self.id})>" return f"<Lottery(id={self.id})>"

View File

@ -10,11 +10,7 @@ class Marsey(Base):
tags = Column(String) tags = Column(String)
count = Column(Integer, default=0) count = Column(Integer, default=0)
submitter_id = Column(Integer, ForeignKey("users.id")) submitter_id = Column(Integer, ForeignKey("users.id"))
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<Marsey(name={self.name})>" return f"<Marsey(name={self.name})>"

View File

@ -9,11 +9,7 @@ class Mod(Base):
__tablename__ = "mods" __tablename__ = "mods"
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True) user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
sub = Column(String, ForeignKey("subs.name"), primary_key=True) sub = Column(String, ForeignKey("subs.name"), primary_key=True)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<Mod(user_id={self.user_id}, sub={self.sub})>" return f"<Mod(user_id={self.user_id}, sub={self.sub})>"

View File

@ -16,16 +16,12 @@ class ModAction(Base):
target_submission_id = Column(Integer, ForeignKey("submissions.id")) target_submission_id = Column(Integer, ForeignKey("submissions.id"))
target_comment_id = Column(Integer, ForeignKey("comments.id")) target_comment_id = Column(Integer, ForeignKey("comments.id"))
_note=Column(String) _note=Column(String)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
user = relationship("User", primaryjoin="User.id==ModAction.user_id") user = relationship("User", primaryjoin="User.id==ModAction.user_id")
target_user = relationship("User", primaryjoin="User.id==ModAction.target_user_id") target_user = relationship("User", primaryjoin="User.id==ModAction.target_user_id")
target_post = relationship("Submission") target_post = relationship("Submission")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<ModAction(id={self.id})>" return f"<ModAction(id={self.id})>"

View File

@ -10,14 +10,10 @@ class Notification(Base):
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True) user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
comment_id = Column(Integer, ForeignKey("comments.id"), primary_key=True) comment_id = Column(Integer, ForeignKey("comments.id"), primary_key=True)
read = Column(Boolean, default=False) read = Column(Boolean, default=False)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
comment = relationship("Comment") comment = relationship("Comment")
user = relationship("User") user = relationship("User")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<Notification(id={self.id})>" return f"<Notification(id={self.id})>"

View File

@ -12,15 +12,11 @@ class SubmissionOption(Base):
submission_id = Column(Integer, ForeignKey("submissions.id")) submission_id = Column(Integer, ForeignKey("submissions.id"))
body_html = Column(Text) body_html = Column(Text)
exclusive = Column(Integer) exclusive = Column(Integer)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
votes = relationship("SubmissionOptionVote") votes = relationship("SubmissionOptionVote")
post = relationship("Submission", back_populates="options") post = relationship("Submission", back_populates="options")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<SubmissionOption(id={self.id})>" return f"<SubmissionOption(id={self.id})>"
@ -41,15 +37,11 @@ class SubmissionOptionVote(Base):
option_id = Column(Integer, ForeignKey("submission_options.id"), primary_key=True) option_id = Column(Integer, ForeignKey("submission_options.id"), primary_key=True)
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True) user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
submission_id = Column(Integer, ForeignKey("submissions.id")) submission_id = Column(Integer, ForeignKey("submissions.id"))
user = relationship("User") user = relationship("User")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<SubmissionOptionVote(option_id={self.option_id}, user_id={self.user_id})>" return f"<SubmissionOptionVote(option_id={self.option_id}, user_id={self.user_id})>"
@ -62,15 +54,11 @@ class CommentOption(Base):
comment_id = Column(Integer, ForeignKey("comments.id")) comment_id = Column(Integer, ForeignKey("comments.id"))
body_html = Column(Text) body_html = Column(Text)
exclusive = Column(Integer) exclusive = Column(Integer)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
votes = relationship("CommentOptionVote") votes = relationship("CommentOptionVote")
comment = relationship("Comment", back_populates="options") comment = relationship("Comment", back_populates="options")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<CommentOption(id={self.id})>" return f"<CommentOption(id={self.id})>"
@ -91,14 +79,10 @@ class CommentOptionVote(Base):
option_id = Column(Integer, ForeignKey("comment_options.id"), primary_key=True) option_id = Column(Integer, ForeignKey("comment_options.id"), primary_key=True)
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True) user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
comment_id = Column(Integer, ForeignKey("comments.id")) comment_id = Column(Integer, ForeignKey("comments.id"))
user = relationship("User") user = relationship("User")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<CommentOptionVote(option_id={self.option_id}, user_id={self.user_id})>" return f"<CommentOptionVote(option_id={self.option_id}, user_id={self.user_id})>"

View File

@ -9,14 +9,10 @@ class SaveRelationship(Base):
user_id=Column(Integer, ForeignKey("users.id"), primary_key=True) user_id=Column(Integer, ForeignKey("users.id"), primary_key=True)
submission_id=Column(Integer, ForeignKey("submissions.id"), primary_key=True) submission_id=Column(Integer, ForeignKey("submissions.id"), primary_key=True)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
post = relationship("Submission", uselist=False) post = relationship("Submission", uselist=False)
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<SaveRelationship(user_id={self.user_id}, submission_id={self.submission_id})>" return f"<SaveRelationship(user_id={self.user_id}, submission_id={self.submission_id})>"
@ -27,13 +23,9 @@ class CommentSaveRelationship(Base):
user_id=Column(Integer, ForeignKey("users.id"), primary_key=True) user_id=Column(Integer, ForeignKey("users.id"), primary_key=True)
comment_id=Column(Integer, ForeignKey("comments.id"), primary_key=True) comment_id=Column(Integer, ForeignKey("comments.id"), primary_key=True)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
comment = relationship("Comment", uselist=False) comment = relationship("Comment", uselist=False)
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<CommentSaveRelationship(user_id={self.user_id}, comment_id={self.comment_id})>" return f"<CommentSaveRelationship(user_id={self.user_id}, comment_id={self.comment_id})>"

View File

@ -22,15 +22,11 @@ class Sub(Base):
marseyurl = Column(String) marseyurl = Column(String)
css = Column(String) css = Column(String)
stealth = Column(Boolean) stealth = Column(Boolean)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
blocks = relationship("SubBlock", primaryjoin="SubBlock.sub==Sub.name") blocks = relationship("SubBlock", primaryjoin="SubBlock.sub==Sub.name")
followers = relationship("SubSubscription", primaryjoin="SubSubscription.sub==Sub.name") followers = relationship("SubSubscription", primaryjoin="SubSubscription.sub==Sub.name")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return self.name return self.name

View File

@ -6,11 +6,7 @@ class SubBlock(Base):
__tablename__ = "sub_blocks" __tablename__ = "sub_blocks"
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True) user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
sub = Column(String(20), ForeignKey("subs.name"), primary_key=True) sub = Column(String(20), ForeignKey("subs.name"), primary_key=True)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<SubBlock(user_id={self.user_id}, sub={self.sub})>" return f"<SubBlock(user_id={self.user_id}, sub={self.sub})>"

View File

@ -6,11 +6,7 @@ class SubJoin(Base):
__tablename__ = "sub_joins" __tablename__ = "sub_joins"
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True) user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
sub = Column(String(20), ForeignKey("subs.name"), primary_key=True) sub = Column(String(20), ForeignKey("subs.name"), primary_key=True)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<SubJoin(user_id={self.user_id}, sub={self.sub})>" return f"<SubJoin(user_id={self.user_id}, sub={self.sub})>"

View File

@ -6,11 +6,7 @@ class SubSubscription(Base):
__tablename__ = "sub_subscriptions" __tablename__ = "sub_subscriptions"
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True) user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
sub = Column(String(20), ForeignKey("subs.name"), primary_key=True) sub = Column(String(20), ForeignKey("subs.name"), primary_key=True)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<SubSubscription(user_id={self.user_id}, sub={self.sub})>" return f"<SubSubscription(user_id={self.user_id}, sub={self.sub})>"

View File

@ -24,7 +24,7 @@ class Submission(Base):
id = Column(Integer, primary_key=True) id = Column(Integer, primary_key=True)
author_id = Column(Integer, ForeignKey("users.id")) author_id = Column(Integer, ForeignKey("users.id"))
edited_utc = Column(Integer, default=0) edited_utc = Column(Integer, default=0)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
thumburl = Column(String) thumburl = Column(String)
is_banned = Column(Boolean, default=False) is_banned = Column(Boolean, default=False)
bannedfor = Column(String) bannedfor = Column(String)
@ -69,10 +69,6 @@ class Submission(Base):
bump_utc = deferred(Column(Integer, server_default=FetchedValue())) bump_utc = deferred(Column(Integer, server_default=FetchedValue()))
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<Submission(id={self.id})>" return f"<Submission(id={self.id})>"

View File

@ -7,14 +7,10 @@ class Subscription(Base):
__tablename__ = "subscriptions" __tablename__ = "subscriptions"
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True) user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
submission_id = Column(Integer, ForeignKey("submissions.id"), primary_key=True) submission_id = Column(Integer, ForeignKey("submissions.id"), primary_key=True)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
user = relationship("User", uselist=False) user = relationship("User", uselist=False)
post = relationship("Submission", uselist=False) post = relationship("Submission", uselist=False)
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<Subscription(id={self.id})>" return f"<Subscription(id={self.id})>"

View File

@ -69,7 +69,7 @@ class User(Base):
post_count = Column(Integer, default=0) post_count = Column(Integer, default=0)
comment_count = Column(Integer, default=0) comment_count = Column(Integer, default=0)
received_award_count = Column(Integer, default=0) received_award_count = Column(Integer, default=0)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
admin_level = Column(Integer, default=0) admin_level = Column(Integer, default=0)
last_active = Column(Integer, default=0, nullable=False) last_active = Column(Integer, default=0, nullable=False)
coins_spent = Column(Integer, default=0) coins_spent = Column(Integer, default=0)
@ -134,8 +134,8 @@ class User(Base):
currently_held_lottery_tickets = Column(Integer, default=0) currently_held_lottery_tickets = Column(Integer, default=0)
total_held_lottery_tickets = Column(Integer, default=0) total_held_lottery_tickets = Column(Integer, default=0)
total_lottery_winnings = Column(Integer, default=0) total_lottery_winnings = Column(Integer, default=0)
last_viewed_post_notifs = Column(Integer, default=0) last_viewed_post_notifs = Column(Integer, default=int(time.time()))
last_viewed_log_notifs = Column(Integer, default=0) last_viewed_log_notifs = Column(Integer, default=int(time.time()))
pronouns = Column(String, default='they/them') pronouns = Column(String, default='they/them')
bite = Column(Integer) bite = Column(Integer)
earlylife = Column(Integer) earlylife = Column(Integer)
@ -163,11 +163,6 @@ class User(Base):
kwargs["passhash"] = self.hash_password(kwargs["password"]) kwargs["passhash"] = self.hash_password(kwargs["password"])
kwargs.pop("password") kwargs.pop("password")
if "created_utc" not in kwargs:
kwargs["created_utc"] = int(time.time())
kwargs["last_viewed_post_notifs"] = kwargs["created_utc"]
kwargs["last_viewed_log_notifs"] = kwargs["created_utc"]
super().__init__(**kwargs) super().__init__(**kwargs)
@ -640,7 +635,7 @@ class User(Base):
@property @property
@lazy @lazy
def modaction_notifications_count(self): def modaction_notifications_count(self):
if not self.admin_level: return 0 if not self.admin_level or self.id == AEVANN_ID: return 0
return g.db.query(ModAction).filter( return g.db.query(ModAction).filter(
ModAction.created_utc > self.last_viewed_log_notifs, ModAction.created_utc > self.last_viewed_log_notifs,
ModAction.user_id != self.id, ModAction.user_id != self.id,
@ -754,8 +749,6 @@ class User(Base):
def profile_url(self): def profile_url(self):
if self.agendaposter: if self.agendaposter:
return f"{SITE_FULL}/assets/images/pfps/agendaposter/{random.randint(1, 57)}.webp?v=1" return f"{SITE_FULL}/assets/images/pfps/agendaposter/{random.randint(1, 57)}.webp?v=1"
if self.bite:
return f"{SITE_FULL}/e/marseyvampire.webp"
if self.rainbow: if self.rainbow:
return f"{SITE_FULL}/e/marseysalutepride.webp" return f"{SITE_FULL}/e/marseysalutepride.webp"
if self.profileurl: if self.profileurl:

View File

@ -8,14 +8,10 @@ class UserBlock(Base):
__tablename__ = "userblocks" __tablename__ = "userblocks"
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True) user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
target_id = Column(Integer, ForeignKey("users.id"), primary_key=True) target_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
user = relationship("User", primaryjoin="User.id==UserBlock.user_id", back_populates="blocking") user = relationship("User", primaryjoin="User.id==UserBlock.user_id", back_populates="blocking")
target = relationship("User", primaryjoin="User.id==UserBlock.target_id", back_populates="blocked") target = relationship("User", primaryjoin="User.id==UserBlock.target_id", back_populates="blocked")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<UserBlock(user={self.user_id}, target={self.target_id})>" return f"<UserBlock(user={self.user_id}, target={self.target_id})>"

View File

@ -10,16 +10,11 @@ class ViewerRelationship(Base):
user_id = Column(Integer, ForeignKey('users.id'), primary_key=True) user_id = Column(Integer, ForeignKey('users.id'), primary_key=True)
viewer_id = Column(Integer, ForeignKey('users.id'), primary_key=True) viewer_id = Column(Integer, ForeignKey('users.id'), primary_key=True)
last_view_utc = Column(Integer) last_view_utc = Column(Integer, default=int(time.time()))
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
viewer = relationship("User", primaryjoin="ViewerRelationship.viewer_id == User.id") viewer = relationship("User", primaryjoin="ViewerRelationship.viewer_id == User.id")
def __init__(self, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
if 'last_view_utc' not in kwargs: kwargs['last_view_utc'] = int(time.time())
super().__init__(**kwargs)
def __repr__(self): def __repr__(self):
return f"<ViewerRelationship(user_id={self.user_id}, viewer_id={self.viewer_id})>" return f"<ViewerRelationship(user_id={self.user_id}, viewer_id={self.viewer_id})>"

View File

@ -14,14 +14,10 @@ class Vote(Base):
vote_type = Column(Integer) vote_type = Column(Integer)
app_id = Column(Integer, ForeignKey("oauth_apps.id")) app_id = Column(Integer, ForeignKey("oauth_apps.id"))
real = Column(Boolean, default=True) real = Column(Boolean, default=True)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
user = relationship("User") user = relationship("User")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<Vote(id={self.id})>" return f"<Vote(id={self.id})>"
@ -44,14 +40,10 @@ class CommentVote(Base):
vote_type = Column(Integer) vote_type = Column(Integer)
app_id = Column(Integer, ForeignKey("oauth_apps.id")) app_id = Column(Integer, ForeignKey("oauth_apps.id"))
real = Column(Boolean, default=True) real = Column(Boolean, default=True)
created_utc = Column(Integer) created_utc = Column(Integer, default=int(time.time()))
user = relationship("User") user = relationship("User")
def __init__(self, *args, **kwargs):
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
super().__init__(*args, **kwargs)
def __repr__(self): def __repr__(self):
return f"<CommentVote(id={self.id})>" return f"<CommentVote(id={self.id})>"