Project

General

Profile

Actions

Sub-Task #122

open

Epic #105: Account & Preferences Management

Feature #106: Update profile information

User Story #108: As a user, I want to upload a custom avatar, so that my identity is visually recognizable across the platform.

Integrate S3/local storage for avatar upload (backend)

Sub-Task #122: Integrate S3/local storage for avatar upload (backend)

Added by Bricklou 8 months ago. Updated 20 days ago.

Status:
In Review
Priority:
Normal
Assigned To:
Target version:
Start date:
11/04/2026
Due date:
% Done:

100%

Estimated time:

Description

Technical specification of the avatar API and of how an uploaded image becomes an avatar. The storage backends are in #307.

API:

  • PUT /api/v1/me/avatar takes the image as the raw body, 2 MB at most, and returns the current user. DELETE /api/v1/me/avatar removes the avatar and succeeds when there is none.
  • GET /api/v1/users/{id}/avatar returns the image to any signed-in user, with an ETag and a cache header. A request that already has the current ETag gets 304. A user without avatar gets 404.
  • The user response and the user summaries carry avatar_url, versioned by the date of the avatar, so a cache can keep the image for good. It is null without avatar.
  • An account that signs in through a login provider is refused with 403.
  • Errors are Problem Details documented in the OpenAPI schema: 401 without a session, 413 for a file or an image that is too large, 422 for a file that is not a supported image.

Image:

  • The image is decoded with limits on its size, cropped to its centre square, scaled to 256 pixels and stored as WebP. Metadata of the original is not kept. This is done by a helper shared with every feature that takes an image.

Data:

  • The account keeps the key of its avatar and the date it was set. The new file is stored first, then the account points to it, then the previous file is deleted. If the account cannot be updated, the new file is deleted.
  • Each change is written to the change log.

Acceptance criteria:

  • An image becomes the avatar, and is served as WebP with an ETag.
  • A file that is not an image, or is too large, is refused with the right status.
  • Replacing or removing the avatar deletes the previous file.
  • A login provider account cannot change its avatar.
  • Each change is in the change log.
  • Every case is covered by a test, with a real database.

Updated by Bricklou 20 days ago Author Actions #1

  • Description updated (diff)
  • Status changed from Draft to To Do

Updated by Bricklou 20 days ago Author Actions #2

  • Status changed from To Do to Planned
  • Assigned To set to Bricklou
  • Target version set to Server 0.1.0
  • Start date deleted (03/28/2026)

Updated by Bricklou 20 days ago Author Actions #3

  • Status changed from Planned to In Progress
  • Start date set to 11/04/2026

Updated by Bricklou 20 days ago Author Actions #4

  • Status changed from In Progress to In Review
  • % Done changed from 0 to 100
Actions

Also available in: PDF Atom