Skip to content

Add Player.currentAvatar DTO field, deprecate AvatarAssignment.selected#280

Merged
Brutus5000 merged 1 commit into
developfrom
feat/player-current-avatar
Jun 26, 2026
Merged

Add Player.currentAvatar DTO field, deprecate AvatarAssignment.selected#280
Brutus5000 merged 1 commit into
developfrom
feat/player-current-avatar

Conversation

@Brutus5000

@Brutus5000 Brutus5000 commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

Mirrors the faf-java-api change (FAForever/faf-java-api#1146) that makes the API the single writer of a player's selected avatar via the login.avatar_id column, exposed as the player.currentAvatar relationship.

  • Player — adds the currentAvatar relationship (@Relationship("currentAvatar"), type Avatar). Not @JsonIgnore'd so clients can PATCH it to change the selected avatar.
  • AvatarAssignment — marks selected as @Deprecated(forRemoval = true); the selected avatar is now tracked via Player.getCurrentAvatar().

Context

Part of migrating FAF's "currently selected avatar" off the legacy avatars.selected join-table flag to the login.avatar_id FK, with the lobby reacting via RabbitMQ. The downlords-faf-client migration to PATCH currentAvatar (instead of the lobby socket command) depends on this commons release.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Player data now includes a current avatar relationship, making the active avatar available through the API.
  • Bug Fixes
    • Legacy avatar selection tracking is now marked for deprecation, with guidance to use the updated current avatar relationship instead.

…ected

Mirror the faf-java-api change that tracks the selected avatar via the
login.avatar_id column exposed as the player.currentAvatar relationship.
The AvatarAssignment.selected flag is now deprecated for removal.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 62d98869-d40f-48dc-b585-c0ff7ec65687

📥 Commits

Reviewing files that changed from the base of the PR and between 673ac2f and 87ea0d3.

📒 Files selected for processing (2)
  • api/src/main/java/com/faforever/commons/api/dto/AvatarAssignment.java
  • api/src/main/java/com/faforever/commons/api/dto/Player.java

📝 Walkthrough

Walkthrough

Player now exposes a currentAvatar relationship, and AvatarAssignment.selected is marked deprecated for removal with Javadoc pointing to the new avatar relationship.

Changes

Avatar relationship contract update

Layer / File(s) Summary
Player current avatar relationship
api/src/main/java/com/faforever/commons/api/dto/Player.java
Player adds a currentAvatar relationship field of type Avatar mapped as @Relationship("currentAvatar").
Legacy selected flag deprecation
api/src/main/java/com/faforever/commons/api/dto/AvatarAssignment.java
selected is documented as legacy and marked @Deprecated(forRemoval = true), with guidance to use Player#getCurrentAvatar().

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A bunny hops by, ears held high,
New avatar stars now twinkle nigh.
Old selected sighs, “I’ve had my day,”
But currentAvatar leads the way.
🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main API DTO change and the deprecation of the legacy avatar selection field.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/player-current-avatar

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Brutus5000 Brutus5000 merged commit 2e8a5a8 into develop Jun 26, 2026
1 of 2 checks passed
@Brutus5000 Brutus5000 deleted the feat/player-current-avatar branch June 26, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant