Type: Backend / Media / Integration
Priority: High
Description
Connect the existing media upload infrastructure to Events, Groups and User Profiles.
The current media module supports presigned uploads, ownership checks, metadata validation and lifecycle states, but uploaded media assets are not yet attached to domain entities. Event images still rely on client-provided URLs, while group images and profile avatars are not persisted.
Replace direct image URL handling with server-controlled media asset references and provide stable frontend-facing image contracts.
Scope
-
Replace client-controlled Event imageUrl input with an optional imageMediaId.
-
Add a media relationship for Event images.
-
Validate Event image attachments:
- Media belongs to the current user.
- Media purpose is
EVENT_IMAGE.
- Media status is
UPLOADED.
-
Mark media as ATTACHED when successfully assigned to an Event.
-
Support Event image replacement and removal.
-
Define cleanup behavior for replaced or removed Event images.
-
Add an avatar media relationship to User Profile.
-
Add endpoints or request fields for:
- Updating the current user's avatar.
- Removing the current user's avatar.
-
Validate Profile avatar attachments:
- Media belongs to the current user.
- Media purpose is
PROFILE_AVATAR.
- Media status is
UPLOADED.
-
Add a media relationship for Event Group images.
-
Support Group image assignment, replacement and removal.
-
Restrict Group image changes to the Group admin or authorized users.
-
Validate Group image attachments:
- Media belongs to the current user.
- Media purpose is
GROUP_IMAGE.
- Media status is
UPLOADED.
-
Return frontend-usable image information in Event, Group and User Profile response DTOs.
-
Keep media attachment and domain entity updates transactionally consistent.
-
Prevent a single media asset from being attached to incompatible or multiple entities where not allowed.
-
Remove or deprecate direct client-provided image URL fields.
-
Update Liquibase migrations for the new media relationships.
-
Add unit, repository and integration tests for attachment, replacement and removal flows.
-
Update OpenAPI documentation and Bruno collections.
Acceptance Criteria
- Events accept an uploaded
EVENT_IMAGE media asset instead of an arbitrary client-provided image URL.
- Event creation and update reject media owned by another user.
- Event creation and update reject media with an invalid purpose or lifecycle status.
- Event images can be assigned, replaced and removed.
- User Profiles support avatar assignment, replacement and removal.
- Event Groups support image assignment, replacement and removal.
- Only authorized Group users can modify the Group image.
- Successfully attached media transitions from
UPLOADED to ATTACHED.
- Replaced and removed media follow a documented cleanup lifecycle.
- Domain operations do not leave partially attached media when a transaction fails.
- Event, Group and User Profile responses include frontend-usable image information.
- Direct arbitrary image URL submission is no longer used for managed images.
- Liquibase migrations apply successfully on a clean PostgreSQL database.
- Integration tests cover Event, Group and Profile media flows.
- OpenAPI and Bruno documentation reflect the final media attachment contracts.
Type: Backend / Media / Integration
Priority: High
Description
Connect the existing media upload infrastructure to Events, Groups and User Profiles.
The current media module supports presigned uploads, ownership checks, metadata validation and lifecycle states, but uploaded media assets are not yet attached to domain entities. Event images still rely on client-provided URLs, while group images and profile avatars are not persisted.
Replace direct image URL handling with server-controlled media asset references and provide stable frontend-facing image contracts.
Scope
Replace client-controlled Event
imageUrlinput with an optionalimageMediaId.Add a media relationship for Event images.
Validate Event image attachments:
EVENT_IMAGE.UPLOADED.Mark media as
ATTACHEDwhen successfully assigned to an Event.Support Event image replacement and removal.
Define cleanup behavior for replaced or removed Event images.
Add an avatar media relationship to User Profile.
Add endpoints or request fields for:
Validate Profile avatar attachments:
PROFILE_AVATAR.UPLOADED.Add a media relationship for Event Group images.
Support Group image assignment, replacement and removal.
Restrict Group image changes to the Group admin or authorized users.
Validate Group image attachments:
GROUP_IMAGE.UPLOADED.Return frontend-usable image information in Event, Group and User Profile response DTOs.
Keep media attachment and domain entity updates transactionally consistent.
Prevent a single media asset from being attached to incompatible or multiple entities where not allowed.
Remove or deprecate direct client-provided image URL fields.
Update Liquibase migrations for the new media relationships.
Add unit, repository and integration tests for attachment, replacement and removal flows.
Update OpenAPI documentation and Bruno collections.
Acceptance Criteria
EVENT_IMAGEmedia asset instead of an arbitrary client-provided image URL.UPLOADEDtoATTACHED.