Add uploaded profile images (SCR-1)
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 16s
CI / federation-interop (push) Successful in 1m40s
CI / test (push) Successful in 4m48s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / trigger-deploy (push) Skipped
CI / notify (push) Successful in 5s
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 16s
CI / federation-interop (push) Successful in 1m40s
CI / test (push) Successful in 4m48s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / trigger-deploy (push) Skipped
CI / notify (push) Successful in 5s
Users can upload, fetch and remove a profile image at /api/v1/me/avatar. The bytes live in an avatars folder inside ART_STORAGE_DIR; the users row records the source and content type. Adds metrics, AVATAR_UPLOAD_MAX_BYTES and the regenerated OpenAPI document. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
81e0b0cf42
commit
c55a6596d0
11 files changed
+555
-1
No files matched your search
@@ -28,9 +28,18 @@ class User(db.Model):
|
||||
email: Mapped[str] = mapped_column(String(255))
|
||||
password_hash: Mapped[str] = mapped_column(String(255))
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=utcnow)
|
||||
# The profile image: none, upload or gravatar. Any image's bytes sit on disk (see
|
||||
# services/avatars.py); these columns just say whether there is one, and what it is.
|
||||
avatar_source: Mapped[str] = mapped_column(String(16), default="none", server_default="none")
|
||||
avatar_content_type: Mapped[str | None] = mapped_column(String(32))
|
||||
avatar_updated_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
|
||||
|
||||
__table_args__ = (Index("uq_users_username_lower", func.lower(username), unique=True),)
|
||||
|
||||
@property
|
||||
def has_avatar(self) -> bool:
|
||||
return self.avatar_source != "none"
|
||||
|
||||
|
||||
class ApiApp(db.Model):
|
||||
"""A client application; scrobblers authenticate with its key and secret."""
|
||||
|
||||
Reference in new issue
Block a user