forked from rDrama/rDrama
Apply Optional to nullable columns
parent
74e025a6ed
commit
84f3025b1f
|
@ -1,4 +1,5 @@
|
|||
import time
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
@ -12,7 +13,7 @@ class Alt(Base):
|
|||
user1: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
||||
user2: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
||||
is_manual: Mapped[bool] = mapped_column(default=False)
|
||||
created_utc: Mapped[int]
|
||||
created_utc: Mapped[Optional[int]]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
@ -18,13 +18,13 @@ class AwardRelationship(Base):
|
|||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
post_id: Mapped[int] = mapped_column(ForeignKey("posts.id"))
|
||||
comment_id: Mapped[int] = mapped_column(ForeignKey("comments.id"))
|
||||
post_id: Mapped[Optional[int]] = mapped_column(ForeignKey("posts.id"))
|
||||
comment_id: Mapped[Optional[int]] = mapped_column(ForeignKey("comments.id"))
|
||||
kind: Mapped[str]
|
||||
awarded_utc: Mapped[int]
|
||||
created_utc: Mapped[int]
|
||||
awarded_utc: Mapped[Optional[int]]
|
||||
created_utc: Mapped[Optional[int]]
|
||||
price_paid: Mapped[int] = mapped_column(default = 0)
|
||||
note: Mapped[str]
|
||||
note: Mapped[Optional[str]]
|
||||
|
||||
user: Mapped["User"] = relationship(primaryjoin="AwardRelationship.user_id==User.id", back_populates="awards")
|
||||
post: Mapped["Post"] = relationship(primaryjoin="AwardRelationship.post_id==Post.id", back_populates="awards")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
@ -18,7 +18,7 @@ class BadgeDef(Base):
|
|||
|
||||
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
||||
name: Mapped[str]
|
||||
description: Mapped[str]
|
||||
description: Mapped[Optional[str]]
|
||||
created_utc: Mapped[int]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -39,8 +39,8 @@ class Badge(Base):
|
|||
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey('users.id'), primary_key=True)
|
||||
badge_id: Mapped[int] = mapped_column(ForeignKey('badge_defs.id'), primary_key=True)
|
||||
description: Mapped[str]
|
||||
url: Mapped[str]
|
||||
description: Mapped[Optional[str]]
|
||||
url: Mapped[Optional[str]]
|
||||
created_utc: Mapped[int]
|
||||
|
||||
user: Mapped["User"] = relationship(back_populates="badges")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Annotated, Optional, TYPE_CHECKING
|
||||
|
||||
from flask import g
|
||||
from sqlalchemy import ForeignKey
|
||||
|
@ -21,12 +21,12 @@ class OauthApp(Base):
|
|||
__tablename__ = "oauth_apps"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
client_id: Mapped[str]
|
||||
client_id: Mapped[Optional[Annotated[str, 64]]]
|
||||
app_name: Mapped[str]
|
||||
redirect_uri: Mapped[str]
|
||||
description: Mapped[str]
|
||||
author_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
created_utc: Mapped[int]
|
||||
created_utc: Mapped[Optional[int]]
|
||||
|
||||
author: Mapped["User"] = relationship(back_populates="apps")
|
||||
|
||||
|
@ -59,7 +59,7 @@ class ClientAuth(Base):
|
|||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
||||
oauth_client: Mapped[int] = mapped_column(ForeignKey("oauth_apps.id"), primary_key=True)
|
||||
access_token: Mapped[str]
|
||||
created_utc: Mapped[int]
|
||||
created_utc: Mapped[Optional[int]]
|
||||
|
||||
user: Mapped["User"] = relationship()
|
||||
application: Mapped["OauthApp"] = relationship()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import time
|
||||
from math import floor
|
||||
from random import randint
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
from urllib.parse import parse_qs, urlencode, urlparse
|
||||
from flask import g
|
||||
|
||||
|
@ -178,38 +178,38 @@ class Comment(Base):
|
|||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
author_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
parent_post: Mapped[int] = mapped_column(ForeignKey("posts.id"))
|
||||
wall_user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
parent_post: Mapped[Optional[int]] = mapped_column(ForeignKey("posts.id"))
|
||||
wall_user_id: Mapped[Optional[int]] = mapped_column(ForeignKey("users.id"))
|
||||
created_utc: Mapped[int]
|
||||
edited_utc: Mapped[int] = mapped_column(default=0)
|
||||
is_banned: Mapped[bool] = mapped_column(default=False)
|
||||
ghost: Mapped[bool] = mapped_column(default=False)
|
||||
bannedfor: Mapped[str]
|
||||
chuddedfor: Mapped[str]
|
||||
bannedfor: Mapped[Optional[str]]
|
||||
chuddedfor: Mapped[Optional[str]]
|
||||
distinguished: Mapped[bool] = mapped_column(default=False)
|
||||
deleted_utc: Mapped[int] = mapped_column(default=0)
|
||||
is_approved: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
is_approved: Mapped[Optional[int]] = mapped_column(ForeignKey("users.id"))
|
||||
level: Mapped[int] = mapped_column(default=1)
|
||||
parent_comment_id: Mapped[int] = mapped_column(ForeignKey("comments.id"))
|
||||
top_comment_id: Mapped[int]
|
||||
parent_comment_id: Mapped[Optional[int]] = mapped_column(ForeignKey("comments.id"))
|
||||
top_comment_id: Mapped[Optional[int]]
|
||||
is_bot: Mapped[bool] = mapped_column(default=False)
|
||||
stickied: Mapped[str]
|
||||
stickied_utc: Mapped[int]
|
||||
stickied: Mapped[Optional[str]]
|
||||
stickied_utc: Mapped[Optional[int]]
|
||||
num_of_pinned_children: Mapped[int] = mapped_column(default=0)
|
||||
sentto: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
app_id: Mapped[int] = mapped_column(ForeignKey("oauth_apps.id"))
|
||||
sentto: Mapped[Optional[int]] = mapped_column(ForeignKey("users.id"))
|
||||
app_id: Mapped[Optional[int]] = mapped_column(ForeignKey("oauth_apps.id"))
|
||||
upvotes: Mapped[int] = mapped_column(default=1)
|
||||
downvotes: Mapped[int] = mapped_column(default=0)
|
||||
realupvotes: Mapped[int] = mapped_column(default=1)
|
||||
body: Mapped[str]
|
||||
body_html: Mapped[str]
|
||||
body: Mapped[Optional[str]]
|
||||
body_html: Mapped[Optional[str]]
|
||||
body_ts: Mapped[str] = mapped_column(TSVECTOR(), server_default=FetchedValue())
|
||||
ban_reason: Mapped[str]
|
||||
treasure_amount: Mapped[str]
|
||||
slots_result: Mapped[str]
|
||||
ban_reason: Mapped[Optional[str]]
|
||||
treasure_amount: Mapped[Optional[str]]
|
||||
slots_result: Mapped[Optional[str]]
|
||||
ping_cost: Mapped[int] = mapped_column(default=0)
|
||||
blackjack_result: Mapped[str]
|
||||
casino_game_id: Mapped[int] = mapped_column(ForeignKey("casino_games.id"))
|
||||
blackjack_result: Mapped[Optional[str]]
|
||||
casino_game_id: Mapped[Optional[int]] = mapped_column(ForeignKey("casino_games.id"))
|
||||
chudded: Mapped[bool] = mapped_column(default=False)
|
||||
rainbowed: Mapped[bool] = mapped_column(default=False)
|
||||
queened: Mapped[bool] = mapped_column(default=False)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import time
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
from sqlalchemy.sql.sqltypes import *
|
||||
|
@ -9,7 +10,7 @@ class BannedDomain(Base):
|
|||
__tablename__ = "banneddomains"
|
||||
domain: Mapped[str] = mapped_column(primary_key=True)
|
||||
reason: Mapped[str]
|
||||
created_utc: Mapped[int]
|
||||
created_utc: Mapped[Optional[int]]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import time
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
@ -14,7 +15,7 @@ class Emoji(Base):
|
|||
author_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
tags: Mapped[str]
|
||||
count: Mapped[int] = mapped_column(default=0)
|
||||
submitter_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
submitter_id: Mapped[Optional[int]] = mapped_column(ForeignKey("users.id"))
|
||||
created_utc: Mapped[int]
|
||||
nsfw: Mapped[bool] = mapped_column(default=False)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
from sqlalchemy.types import Integer
|
||||
|
@ -18,9 +18,9 @@ class Group(Base):
|
|||
__tablename__ = "groups"
|
||||
name: Mapped[str] = mapped_column(primary_key=True)
|
||||
created_utc: Mapped[int]
|
||||
owner_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
description: Mapped[str]
|
||||
description_html: Mapped[str]
|
||||
owner_id: Mapped[Optional[int]] = mapped_column(ForeignKey("users.id"))
|
||||
description: Mapped[Optional[str]]
|
||||
description_html: Mapped[Optional[str]]
|
||||
|
||||
memberships: Mapped[list["GroupMembership"]] = relationship(primaryjoin="GroupMembership.group_name==Group.name", order_by="GroupMembership.approved_utc")
|
||||
owner: Mapped["User"] = relationship(primaryjoin="Group.owner_id==User.id")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
@ -16,7 +16,7 @@ class GroupMembership(Base):
|
|||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
||||
group_name: Mapped[str] = mapped_column(ForeignKey("groups.name"), primary_key=True)
|
||||
created_utc: Mapped[int]
|
||||
approved_utc: Mapped[int]
|
||||
approved_utc: Mapped[Optional[int]]
|
||||
is_mod: Mapped[bool] = mapped_column(default=False)
|
||||
|
||||
user: Mapped["User"] = relationship(uselist=False)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
@ -22,7 +22,7 @@ class HatDef(Base):
|
|||
description: Mapped[str]
|
||||
author_id: Mapped[int] = mapped_column(ForeignKey('users.id'))
|
||||
price: Mapped[int]
|
||||
submitter_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
submitter_id: Mapped[Optional[int]] = mapped_column(ForeignKey("users.id"))
|
||||
created_utc: Mapped[int]
|
||||
|
||||
author: Mapped["User"] = relationship(primaryjoin="HatDef.author_id == User.id", back_populates="designed_hats")
|
||||
|
@ -55,8 +55,8 @@ class Hat(Base):
|
|||
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey('users.id'), primary_key=True)
|
||||
hat_id: Mapped[int] = mapped_column(ForeignKey('hat_defs.id'), primary_key=True)
|
||||
equipped: Mapped[bool] = mapped_column(default=False)
|
||||
created_utc: Mapped[int]
|
||||
equipped: Mapped[Optional[bool]] = mapped_column(default=False)
|
||||
created_utc: Mapped[Optional[int]]
|
||||
|
||||
hat_def: Mapped["HatDef"] = relationship()
|
||||
owners: Mapped[list["User"]] = relationship(back_populates="owned_hats")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import random
|
||||
import time
|
||||
from typing import Annotated
|
||||
from typing import Annotated, Optional
|
||||
|
||||
from sqlalchemy.ext.mutable import MutableList
|
||||
from sqlalchemy.orm import DynamicMapped, Mapped, mapped_column, relationship
|
||||
|
@ -15,19 +15,19 @@ from .hole_relationship import *
|
|||
class Hole(Base):
|
||||
__tablename__ = "holes"
|
||||
name: Mapped[str] = mapped_column(primary_key=True)
|
||||
sidebar: Mapped[str]
|
||||
sidebar_html: Mapped[str]
|
||||
sidebar: Mapped[Optional[str]]
|
||||
sidebar_html: Mapped[Optional[str]]
|
||||
sidebarurls: Mapped[list[str]] = mapped_column(MutableList.as_mutable(ARRAY(String)), default=MutableList([]))
|
||||
bannerurls: Mapped[list[str]] = mapped_column(MutableList.as_mutable(ARRAY(String)), default=MutableList([]))
|
||||
marseyurl: Mapped[str]
|
||||
css: Mapped[str] = mapped_column(deferred=True)
|
||||
stealth: Mapped[bool] = mapped_column(default=False)
|
||||
marseyurl: Mapped[Optional[str]]
|
||||
css: Mapped[Optional[str]] = mapped_column(deferred=True)
|
||||
stealth: Mapped[Optional[bool]] = mapped_column(default=False)
|
||||
public_use: Mapped[bool] = mapped_column(default=False)
|
||||
created_utc: Mapped[int]
|
||||
created_utc: Mapped[Optional[int]]
|
||||
if SITE_NAME == 'WPD':
|
||||
snappy_quotes = None
|
||||
else:
|
||||
snappy_quotes: Mapped[Annotated[str, HOLE_SNAPPY_QUOTES_LENGTH]] = mapped_column(deferred=True)
|
||||
snappy_quotes: Mapped[Optional[Annotated[str, HOLE_SNAPPY_QUOTES_LENGTH]]] = mapped_column(deferred=True)
|
||||
|
||||
blocks: Mapped[list["HoleBlock"]] = relationship(primaryjoin="HoleBlock.hole==Hole.name")
|
||||
followers: Mapped[list["HoleFollow"]] = relationship(primaryjoin="HoleFollow.hole==Hole.name")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
@ -20,12 +20,12 @@ class HoleAction(Base):
|
|||
__tablename__ = "hole_actions"
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
hole: Mapped[str] = mapped_column(ForeignKey("holes.name"))
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
kind: Mapped[str]
|
||||
target_user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
target_post_id: Mapped[int] = mapped_column(ForeignKey("posts.id"))
|
||||
target_comment_id: Mapped[int] = mapped_column(ForeignKey("comments.id"))
|
||||
_note: Mapped[str]
|
||||
user_id: Mapped[Optional[int]] = mapped_column(ForeignKey("users.id"))
|
||||
kind: Mapped[Optional[str]]
|
||||
target_user_id: Mapped[Optional[int]] = mapped_column(ForeignKey("users.id"))
|
||||
target_post_id: Mapped[Optional[int]] = mapped_column(ForeignKey("posts.id"))
|
||||
target_comment_id: Mapped[Optional[int]] = mapped_column(ForeignKey("comments.id"))
|
||||
_note: Mapped[Optional[str]]
|
||||
created_utc: Mapped[int]
|
||||
|
||||
user: Mapped["User"] = relationship(primaryjoin="User.id==HoleAction.user_id")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy.orm import Mapped, relationship, mapped_column
|
||||
|
@ -17,7 +17,7 @@ class HoleRelationship(Base):
|
|||
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
||||
hole: Mapped[str] = mapped_column(ForeignKey("holes.name"), primary_key=True)
|
||||
created_utc: Mapped[int]
|
||||
created_utc: Mapped[Optional[int]]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import time
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
@ -16,8 +17,8 @@ class Lottery(Base):
|
|||
ends_at: Mapped[int]
|
||||
prize: Mapped[int] = mapped_column(default=0)
|
||||
tickets_sold: Mapped[int] = mapped_column(default=0)
|
||||
winner_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
created_utc: Mapped[int]
|
||||
winner_id: Mapped[Optional[int]] = mapped_column(ForeignKey("users.id"))
|
||||
created_utc: Mapped[Optional[int]]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
@ -19,12 +19,12 @@ if TYPE_CHECKING:
|
|||
class ModAction(Base):
|
||||
__tablename__ = "modactions"
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
kind: Mapped[str]
|
||||
target_user_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
target_post_id: Mapped[int] = mapped_column(ForeignKey("posts.id"))
|
||||
target_comment_id: Mapped[int] = mapped_column(ForeignKey("comments.id"))
|
||||
_note: Mapped[str]
|
||||
user_id: Mapped[Optional[int]] = mapped_column(ForeignKey("users.id"))
|
||||
kind: Mapped[Optional[str]]
|
||||
target_user_id: Mapped[Optional[int]] = mapped_column(ForeignKey("users.id"))
|
||||
target_post_id: Mapped[Optional[int]] = mapped_column(ForeignKey("posts.id"))
|
||||
target_comment_id: Mapped[Optional[int]] = mapped_column(ForeignKey("comments.id"))
|
||||
_note: Mapped[Optional[str]]
|
||||
created_utc: Mapped[int]
|
||||
|
||||
user: Mapped["User"] = relationship(primaryjoin="User.id==ModAction.user_id")
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import time
|
||||
from flask import g, abort
|
||||
import requests
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy import or_
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
@ -19,7 +20,7 @@ class Orgy(Base):
|
|||
data: Mapped[str]
|
||||
title: Mapped[str]
|
||||
start_utc: Mapped[int]
|
||||
end_utc: Mapped[int]
|
||||
end_utc: Mapped[Optional[int]]
|
||||
started: Mapped[bool] = mapped_column(default=False)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
@ -19,7 +19,7 @@ class PostOption(Base):
|
|||
parent_id: Mapped[int] = mapped_column(ForeignKey("posts.id"))
|
||||
body_html: Mapped[str] = mapped_column(Text)
|
||||
exclusive: Mapped[int]
|
||||
created_utc: Mapped[int]
|
||||
created_utc: Mapped[Optional[int]]
|
||||
|
||||
votes: Mapped[list["PostOptionVote"]] = relationship()
|
||||
parent: Mapped["Post"] = relationship(back_populates="options")
|
||||
|
@ -48,7 +48,7 @@ class PostOptionVote(Base):
|
|||
option_id: Mapped[int] = mapped_column(ForeignKey("post_options.id"), primary_key=True)
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
||||
created_utc: Mapped[int]
|
||||
post_id: Mapped[int] = mapped_column(ForeignKey("posts.id"))
|
||||
post_id: Mapped[Optional[int]] = mapped_column(ForeignKey("posts.id"))
|
||||
|
||||
user: Mapped["User"] = relationship()
|
||||
|
||||
|
@ -68,7 +68,7 @@ class CommentOption(Base):
|
|||
parent_id: Mapped[int] = mapped_column(ForeignKey("comments.id"))
|
||||
body_html: Mapped[str] = mapped_column(Text)
|
||||
exclusive: Mapped[int]
|
||||
created_utc: Mapped[int]
|
||||
created_utc: Mapped[Optional[int]]
|
||||
|
||||
votes: Mapped[list["CommentOptionVote"]] = relationship()
|
||||
parent: Mapped["Comment"] = relationship(back_populates="options")
|
||||
|
@ -97,7 +97,7 @@ class CommentOptionVote(Base):
|
|||
option_id: Mapped[int] = mapped_column(ForeignKey("comment_options.id"), primary_key=True)
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
||||
created_utc: Mapped[int]
|
||||
comment_id: Mapped[int] = mapped_column(ForeignKey("comments.id"))
|
||||
comment_id: Mapped[Optional[int]] = mapped_column(ForeignKey("comments.id"))
|
||||
|
||||
user: Mapped["User"] = relationship()
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import random
|
||||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
from urllib.parse import urlparse
|
||||
from flask import g
|
||||
|
||||
|
@ -34,38 +34,38 @@ class Post(Base):
|
|||
author_id: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
edited_utc: Mapped[int] = mapped_column(default=0)
|
||||
created_utc: Mapped[int]
|
||||
thumburl: Mapped[str]
|
||||
posterurl: Mapped[str]
|
||||
thumburl: Mapped[Optional[str]]
|
||||
posterurl: Mapped[Optional[str]]
|
||||
is_banned: Mapped[bool] = mapped_column(default=False)
|
||||
bannedfor: Mapped[str]
|
||||
chuddedfor: Mapped[str]
|
||||
bannedfor: Mapped[Optional[str]]
|
||||
chuddedfor: Mapped[Optional[str]]
|
||||
ghost: Mapped[bool] = mapped_column(default=False)
|
||||
effortpost: Mapped[bool] = mapped_column(default=False)
|
||||
views: Mapped[int] = mapped_column(default=0)
|
||||
deleted_utc: Mapped[int] = mapped_column(default=0)
|
||||
distinguished: Mapped[bool] = mapped_column(default=False)
|
||||
stickied: Mapped[str]
|
||||
stickied_utc: Mapped[int]
|
||||
hole_pinned: Mapped[str]
|
||||
hole: Mapped[str] = mapped_column(ForeignKey("holes.name"))
|
||||
stickied: Mapped[Optional[str]]
|
||||
stickied_utc: Mapped[Optional[int]]
|
||||
hole_pinned: Mapped[Optional[str]]
|
||||
hole: Mapped[Optional[str]] = mapped_column(ForeignKey("holes.name"))
|
||||
is_pinned: Mapped[bool] = mapped_column(default=False)
|
||||
private: Mapped[bool] = mapped_column(default=False)
|
||||
comment_count: Mapped[int] = mapped_column(default=0)
|
||||
is_approved: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
is_approved: Mapped[Optional[int]] = mapped_column(ForeignKey("users.id"))
|
||||
is_bot: Mapped[bool] = mapped_column(default=False)
|
||||
upvotes: Mapped[int] = mapped_column(default=1)
|
||||
downvotes: Mapped[int] = mapped_column(default=0)
|
||||
realupvotes: Mapped[int] = mapped_column(default=1)
|
||||
app_id: Mapped[int] = mapped_column(ForeignKey("oauth_apps.id"))
|
||||
realupvotes: Mapped[Optional[int]] = mapped_column(default=1)
|
||||
app_id: Mapped[Optional[int]] = mapped_column(ForeignKey("oauth_apps.id"))
|
||||
title: Mapped[str]
|
||||
title_html: Mapped[str]
|
||||
url: Mapped[str]
|
||||
body: Mapped[str]
|
||||
body_html: Mapped[str]
|
||||
flair: Mapped[str]
|
||||
ban_reason: Mapped[str]
|
||||
embed: Mapped[str]
|
||||
new: Mapped[bool]
|
||||
url: Mapped[Optional[str]]
|
||||
body: Mapped[Optional[str]]
|
||||
body_html: Mapped[Optional[str]]
|
||||
flair: Mapped[Optional[str]]
|
||||
ban_reason: Mapped[Optional[str]]
|
||||
embed: Mapped[Optional[str]]
|
||||
new: Mapped[Optional[bool]]
|
||||
notify: Mapped[bool]
|
||||
chudded: Mapped[bool] = mapped_column(default=False)
|
||||
rainbowed: Mapped[bool] = mapped_column(default=False)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
@ -18,7 +18,7 @@ class Report(Base):
|
|||
|
||||
post_id: Mapped[int] = mapped_column(ForeignKey("posts.id"), primary_key=True)
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
||||
reason: Mapped[str]
|
||||
reason: Mapped[Optional[str]]
|
||||
created_utc: Mapped[int]
|
||||
|
||||
user: Mapped["User"] = relationship(primaryjoin = "Report.user_id == User.id", uselist = False)
|
||||
|
@ -46,7 +46,7 @@ class CommentReport(Base):
|
|||
|
||||
comment_id: Mapped[int] = mapped_column(ForeignKey("comments.id"), primary_key=True)
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
||||
reason: Mapped[str]
|
||||
reason: Mapped[Optional[str]]
|
||||
created_utc: Mapped[int]
|
||||
|
||||
user: Mapped["User"] = relationship(primaryjoin = "CommentReport.user_id == User.id", uselist = False)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
@ -17,7 +17,7 @@ class SaveRelationship(Base):
|
|||
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
||||
post_id: Mapped[int] = mapped_column(ForeignKey("posts.id"), primary_key=True)
|
||||
created_utc: Mapped[int]
|
||||
created_utc: Mapped[Optional[int]]
|
||||
|
||||
post: Mapped["Post"] = relationship(uselist=False)
|
||||
|
||||
|
@ -35,7 +35,7 @@ class CommentSaveRelationship(Base):
|
|||
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
||||
comment_id: Mapped[int] = mapped_column(ForeignKey("comments.id"), primary_key=True)
|
||||
created_utc: Mapped[int]
|
||||
created_utc: Mapped[Optional[int]]
|
||||
|
||||
comment: Mapped["Comment"] = relationship(uselist=False)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
@ -15,7 +15,7 @@ class Subscription(Base):
|
|||
__tablename__ = "subscriptions"
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
||||
post_id: Mapped[int] = mapped_column(ForeignKey("posts.id"), primary_key=True)
|
||||
created_utc: Mapped[int]
|
||||
created_utc: Mapped[Optional[int]]
|
||||
|
||||
user: Mapped["User"] = relationship(uselist=False)
|
||||
post: Mapped["Post"] = relationship(uselist=False)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from typing import Optional
|
||||
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
from sqlalchemy.sql.sqltypes import *
|
||||
|
||||
|
@ -10,7 +12,7 @@ class Transaction(Base):
|
|||
type: Mapped[str]
|
||||
amount: Mapped[int]
|
||||
email: Mapped[str]
|
||||
claimed: Mapped[bool]
|
||||
claimed: Mapped[Optional[bool]]
|
||||
|
||||
def __repr__(self):
|
||||
return f"<{self.__class__.__name__}(id={self.id})>"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import random
|
||||
from operator import *
|
||||
from typing import Optional
|
||||
|
||||
import pyotp
|
||||
from sqlalchemy import ForeignKey, FetchedValue
|
||||
|
@ -52,30 +53,30 @@ class User(Base):
|
|||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
username: Mapped[str]
|
||||
namecolor: Mapped[str] = mapped_column(default=DEFAULT_COLOR)
|
||||
background: Mapped[str]
|
||||
profile_background: Mapped[str]
|
||||
flair: Mapped[str] = mapped_column(deferred=True)
|
||||
flair_html: Mapped[str]
|
||||
background: Mapped[Optional[str]]
|
||||
profile_background: Mapped[Optional[str]]
|
||||
flair: Mapped[Optional[str]] = mapped_column(deferred=True)
|
||||
flair_html: Mapped[Optional[str]]
|
||||
flaircolor: Mapped[str] = mapped_column(default=DEFAULT_COLOR)
|
||||
theme: Mapped[str] = mapped_column(default=DEFAULT_THEME)
|
||||
themecolor: Mapped[str] = mapped_column(default=DEFAULT_COLOR)
|
||||
song: Mapped[str]
|
||||
highres: Mapped[str]
|
||||
profileurl: Mapped[str]
|
||||
bannerurl: Mapped[str]
|
||||
house: Mapped[str] = mapped_column(default='')
|
||||
old_house: Mapped[str] = mapped_column(default='')
|
||||
song: Mapped[Optional[str]]
|
||||
highres: Mapped[Optional[str]]
|
||||
profileurl: Mapped[Optional[str]]
|
||||
bannerurl: Mapped[Optional[str]]
|
||||
house: Mapped[Optional[str]] = mapped_column(default='')
|
||||
old_house: Mapped[Optional[str]] = mapped_column(default='')
|
||||
patron: Mapped[int] = mapped_column(default=0)
|
||||
patron_utc: Mapped[int] = mapped_column(default=0)
|
||||
verified: Mapped[str]
|
||||
verifiedcolor: Mapped[str]
|
||||
hieroglyphs: Mapped[int] = mapped_column(default=0)
|
||||
rehab: Mapped[int] = mapped_column(default=0)
|
||||
longpost: Mapped[int] = mapped_column(default=0)
|
||||
bird: Mapped[int] = mapped_column(default=0)
|
||||
email: Mapped[str] = mapped_column(deferred=True)
|
||||
css: Mapped[str]
|
||||
profilecss: Mapped[str] = mapped_column(deferred=True)
|
||||
verified: Mapped[Optional[str]]
|
||||
verifiedcolor: Mapped[Optional[str]]
|
||||
hieroglyphs: Mapped[Optional[int]] = mapped_column(default=0)
|
||||
rehab: Mapped[Optional[int]] = mapped_column(default=0)
|
||||
longpost: Mapped[Optional[int]] = mapped_column(default=0)
|
||||
bird: Mapped[Optional[int]] = mapped_column(default=0)
|
||||
email: Mapped[Optional[str]] = mapped_column(deferred=True)
|
||||
css: Mapped[Optional[str]]
|
||||
profilecss: Mapped[Optional[str]] = mapped_column(deferred=True)
|
||||
passhash: Mapped[str] = mapped_column(deferred=True)
|
||||
post_count: Mapped[int] = mapped_column(default=0)
|
||||
comment_count: Mapped[int] = mapped_column(default=0)
|
||||
|
@ -87,49 +88,49 @@ class User(Base):
|
|||
coins_spent_on_hats: Mapped[int] = mapped_column(default=0)
|
||||
lootboxes_bought: Mapped[int] = mapped_column(default=0)
|
||||
chud: Mapped[int] = mapped_column(default=0)
|
||||
queen: Mapped[int] = mapped_column(default=0)
|
||||
chud_phrase: Mapped[str]
|
||||
queen: Mapped[Optional[int]] = mapped_column(default=0)
|
||||
chud_phrase: Mapped[Optional[str]]
|
||||
email_verified: Mapped[bool] = mapped_column(default=False)
|
||||
shadowbanned: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
chudded_by: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
shadowbanned: Mapped[Optional[int]] = mapped_column(ForeignKey("users.id"))
|
||||
chudded_by: Mapped[Optional[int]] = mapped_column(ForeignKey("users.id"))
|
||||
slurreplacer: Mapped[int] = mapped_column(default=1)
|
||||
profanityreplacer: Mapped[int] = mapped_column(default=1)
|
||||
flairchanged: Mapped[int] = mapped_column(default=0)
|
||||
namechanged: Mapped[int] = mapped_column(default=0)
|
||||
flairchanged: Mapped[Optional[int]] = mapped_column(default=0)
|
||||
namechanged: Mapped[Optional[int]] = mapped_column(default=0)
|
||||
newtab: Mapped[bool] = mapped_column(default=False)
|
||||
newtabexternal: Mapped[bool] = mapped_column(default=True)
|
||||
frontsize: Mapped[int] = mapped_column(default=25)
|
||||
bio: Mapped[str] = mapped_column(deferred=True)
|
||||
bio_html: Mapped[str]
|
||||
sig: Mapped[str] = mapped_column(deferred=True)
|
||||
sig_html: Mapped[str]
|
||||
bio: Mapped[Optional[str]] = mapped_column(deferred=True)
|
||||
bio_html: Mapped[Optional[str]]
|
||||
sig: Mapped[Optional[str]] = mapped_column(deferred=True)
|
||||
sig_html: Mapped[Optional[str]]
|
||||
show_sigs: Mapped[bool] = mapped_column(default=True)
|
||||
progressivestack: Mapped[int] = mapped_column(default=0)
|
||||
deflector: Mapped[int] = mapped_column(default=0)
|
||||
friends: Mapped[str] = mapped_column(deferred=True)
|
||||
friends_html: Mapped[str] = mapped_column(deferred=True)
|
||||
enemies: Mapped[str] = mapped_column(deferred=True)
|
||||
enemies_html: Mapped[str] = mapped_column(deferred=True)
|
||||
is_banned: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
unban_utc: Mapped[int]
|
||||
ban_reason: Mapped[str] = mapped_column(deferred=True)
|
||||
shadowban_reason: Mapped[str] = mapped_column(deferred=True)
|
||||
progressivestack: Mapped[Optional[int]] = mapped_column(default=0)
|
||||
deflector: Mapped[Optional[int]] = mapped_column(default=0)
|
||||
friends: Mapped[Optional[str]] = mapped_column(deferred=True)
|
||||
friends_html: Mapped[Optional[str]] = mapped_column(deferred=True)
|
||||
enemies: Mapped[Optional[str]] = mapped_column(deferred=True)
|
||||
enemies_html: Mapped[Optional[str]] = mapped_column(deferred=True)
|
||||
is_banned: Mapped[Optional[int]] = mapped_column(ForeignKey("users.id"))
|
||||
unban_utc: Mapped[Optional[int]]
|
||||
ban_reason: Mapped[Optional[str]] = mapped_column(deferred=True)
|
||||
shadowban_reason: Mapped[Optional[str]] = mapped_column(deferred=True)
|
||||
is_muted: Mapped[bool] = mapped_column(default=False)
|
||||
login_nonce: Mapped[int] = mapped_column(default=0)
|
||||
coins: Mapped[int] = mapped_column(default=DEFAULT_COINS)
|
||||
truescore: Mapped[int] = mapped_column(default=0)
|
||||
marseybux: Mapped[int] = mapped_column(default=DEFAULT_MARSEYBUX)
|
||||
mfa_secret: Mapped[str] = mapped_column(deferred=True)
|
||||
mfa_secret: Mapped[Optional[str]] = mapped_column(deferred=True)
|
||||
is_private: Mapped[bool] = mapped_column(default=False)
|
||||
stored_subscriber_count: Mapped[int] = mapped_column(default=0)
|
||||
defaultsortingcomments: Mapped[str] = mapped_column(default="hot")
|
||||
defaultsorting: Mapped[str] = mapped_column(default="hot")
|
||||
defaulttime: Mapped[str] = mapped_column(default=DEFAULT_TIME_FILTER)
|
||||
custom_filter_list: Mapped[str]
|
||||
original_username: Mapped[str]
|
||||
extra_username: Mapped[str]
|
||||
prelock_username: Mapped[str]
|
||||
referred_by: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
custom_filter_list: Mapped[Optional[str]]
|
||||
original_username: Mapped[Optional[str]]
|
||||
extra_username: Mapped[Optional[str]]
|
||||
prelock_username: Mapped[Optional[str]]
|
||||
referred_by: Mapped[Optional[int]] = mapped_column(ForeignKey("users.id"))
|
||||
currently_held_lottery_tickets: Mapped[int] = mapped_column(default=0)
|
||||
total_held_lottery_tickets: Mapped[int] = mapped_column(default=0)
|
||||
total_lottery_winnings: Mapped[int] = mapped_column(default=0)
|
||||
|
@ -137,15 +138,15 @@ class User(Base):
|
|||
last_viewed_post_notifs: Mapped[int] = mapped_column(default=0)
|
||||
last_viewed_log_notifs: Mapped[int] = mapped_column(default=0)
|
||||
last_viewed_offsite_notifs: Mapped[int] = mapped_column(default=0)
|
||||
bite: Mapped[int] = mapped_column(default=0)
|
||||
owoify: Mapped[int] = mapped_column(default=0)
|
||||
sharpen: Mapped[int] = mapped_column(default=0)
|
||||
marsify: Mapped[int] = mapped_column(default=0)
|
||||
rainbow: Mapped[int] = mapped_column(default=0)
|
||||
spider: Mapped[int] = mapped_column(default=0)
|
||||
bite: Mapped[Optional[int]] = mapped_column(default=0)
|
||||
owoify: Mapped[Optional[int]] = mapped_column(default=0)
|
||||
sharpen: Mapped[Optional[int]] = mapped_column(default=0)
|
||||
marsify: Mapped[Optional[int]] = mapped_column(default=0)
|
||||
rainbow: Mapped[Optional[int]] = mapped_column(default=0)
|
||||
spider: Mapped[Optional[int]] = mapped_column(default=0)
|
||||
lifetimedonated: Mapped[int] = mapped_column(default=0)
|
||||
lifetimedonated_visible: Mapped[bool] = mapped_column(default=False)
|
||||
blacklisted_by: Mapped[int] = mapped_column(ForeignKey("users.id"))
|
||||
blacklisted_by: Mapped[Optional[int]] = mapped_column(ForeignKey("users.id"))
|
||||
grinch: Mapped[bool] = mapped_column(default=SITE_NAME != 'rDrama') #don't put in an if condition, it will cause an error bc it has a not-null constraint
|
||||
group_creation_notifs: Mapped[bool] = mapped_column(default=False)
|
||||
effortpost_notifs: Mapped[bool] = mapped_column(default=False)
|
||||
|
@ -166,7 +167,7 @@ class User(Base):
|
|||
controversial: Mapped[bool] = mapped_column(default=False)
|
||||
reddit: Mapped[str] = mapped_column(default='old.reddit.com')
|
||||
pronouns: Mapped[str] = mapped_column(default='they/them')
|
||||
earlylife: Mapped[int] = mapped_column(default=0)
|
||||
earlylife: Mapped[Optional[int]] = mapped_column(default=0)
|
||||
hole_creation_notifs: Mapped[bool] = mapped_column(default=True)
|
||||
hidevotedon = False
|
||||
hide_cw = False
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
@ -15,7 +15,7 @@ class UserBlock(Base):
|
|||
__tablename__ = "userblocks"
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
||||
target_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
||||
created_utc: Mapped[int]
|
||||
created_utc: Mapped[Optional[int]]
|
||||
|
||||
user: Mapped["User"] = relationship(primaryjoin="User.id==UserBlock.user_id", back_populates="blocking")
|
||||
target: Mapped["User"] = relationship(primaryjoin="User.id==UserBlock.target_id", back_populates="blocked")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
@ -15,7 +15,7 @@ class UserMute(Base):
|
|||
__tablename__ = "usermutes"
|
||||
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
||||
target_id: Mapped[int] = mapped_column(ForeignKey("users.id"), primary_key=True)
|
||||
created_utc: Mapped[int]
|
||||
created_utc: Mapped[Optional[int]]
|
||||
|
||||
user: Mapped["User"] = relationship(primaryjoin="User.id==UserMute.user_id")
|
||||
target: Mapped["User"] = relationship(primaryjoin="User.id==UserMute.target_id")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
@ -19,7 +19,7 @@ class ViewerRelationship(Base):
|
|||
user_id: Mapped[int] = mapped_column(ForeignKey('users.id'), primary_key=True)
|
||||
viewer_id: Mapped[int] = mapped_column(ForeignKey('users.id'), primary_key=True)
|
||||
last_view_utc: Mapped[int]
|
||||
created_utc: Mapped[int]
|
||||
created_utc: Mapped[Optional[int]]
|
||||
|
||||
viewer: Mapped["User"] = relationship(primaryjoin="ViewerRelationship.viewer_id == User.id")
|
||||
|
||||
|
|
Loading…
Reference in New Issue