~tsileo/microblog.pub

2433fa01cdfd412cba2ad2f44c560593e92660dd — Thomas Sileo 1 year, 3 months ago 3169890
Fix typing
2 files changed, 8 insertions(+), 5 deletions(-)

M app/models.py
M app/uploads.py
M app/models.py => app/models.py +7 -4
@@ 1,4 1,5 @@
import enum
from datetime import datetime
from typing import Any
from typing import Optional
from typing import Union


@@ 436,7 437,7 @@ class OutboxObjectAttachment(Base):
    outbox_object_id = Column(Integer, ForeignKey("outbox.id"), nullable=False)

    upload_id = Column(Integer, ForeignKey("upload.id"), nullable=False)
    upload = relationship(Upload, uselist=False)
    upload: Mapped["Upload"] = relationship(Upload, uselist=False)


class IndieAuthAuthorizationRequest(Base):


@@ 459,7 460,9 @@ class IndieAuthAccessToken(Base):
    __tablename__ = "indieauth_access_token"

    id = Column(Integer, primary_key=True, index=True)
    created_at = Column(DateTime(timezone=True), nullable=False, default=now)
    created_at: Mapped[datetime] = Column(
        DateTime(timezone=True), nullable=False, default=now
    )

    # Will be null for personal access tokens
    indieauth_authorization_request_id = Column(


@@ 470,9 473,9 @@ class IndieAuthAccessToken(Base):
        uselist=False,
    )

    access_token = Column(String, nullable=False, unique=True, index=True)
    access_token: Mapped[str] = Column(String, nullable=False, unique=True, index=True)
    refresh_token = Column(String, nullable=True, unique=True, index=True)
    expires_in = Column(Integer, nullable=False)
    expires_in: Mapped[int] = Column(Integer, nullable=False)
    scope = Column(String, nullable=False)
    is_revoked = Column(Boolean, nullable=False, default=False)
    was_refreshed = Column(Boolean, nullable=False, default=False, server_default="0")

M app/uploads.py => app/uploads.py +1 -1
@@ 60,7 60,7 @@ async def save_upload(db_session: AsyncSession, f: UploadFile) -> models.Upload:
            destination_image.putdata(original_image.getdata())
            destination_image.save(
                dest_filename,
                format=_original_image.format,
                format=_original_image.format,  # type: ignore
            )

            with open(dest_filename, "rb") as dest_f: