Skip to content

Add AvatarData into the chat reaction setup - #899

Merged
tickBit merged 2 commits into
devfrom
861-feature-request-add-avatardata-into-the-chat-reaction-data
Aug 8, 2026
Merged

Add AvatarData into the chat reaction setup#899
tickBit merged 2 commits into
devfrom
861-feature-request-add-avatardata-into-the-chat-reaction-data

Conversation

@CapoMK25

@CapoMK25 CapoMK25 commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Brief description

Closes #861

Implements AvatarData into the chat reaction setup successfully. On top of successful unit tests (when ran individually), backend testing for this was done through in-memory script execution, here's the output:

[capomk@archlinux Altzone-Server]$ npx ts-node -e "
import 'reflect-metadata';
import { plainToInstance } from 'class-transformer';
import { ReactionDto } from './src/chat/dto/reaction.dto';

const sampleReaction = {
  playerName: 'ShadowKnight',
  emoji: '🔥',
  sender_id: '64f1a2b3c4d5e6f7a8b9c0d1',
  avatarData: {
    head: { id: 1, color: '#ff0000' },
    hair: 2,
    skinColor: '#FAD9B5'
  }
};
   
const result = plainToInstance(ReactionDto, sampleReaction, { excludeExtraneousValues: true });
console.log('Transformed ReactionDto:\n', JSON.stringify(result, null, 2));
"
Transformed ReactionDto:
 {
  "playerName": "ShadowKnight",
  "emoji": "🔥",
  "sender_id": "64f1a2b3c4d5e6f7a8b9c0d1",
  "avatarData": {
    "head": {
      "id": 1,
      "color": "#ff0000"
    },
    "hair": {
      "id": 2,
      "color": "#ffffff"
    },
    "skinColor": "#FAD9B5"
  }
}
[capomk@archlinux Altzone-Server]$ git add . 
[capomk@archlinux Altzone-Server]$ npx ts-node -e "
import 'reflect-metadata';
import { plainToInstance } from 'class-transformer';
import { ReactionDto } from './src/chat/dto/reaction.dto';

const reactionPayload = [
  {
    playerName: 'PlayerOne',
    emoji: '👍',
    sender_id: '123',
    avatarData: {
      head: 1,
      skinColor: '#ffffff'
    }
  },
  {
    playerName: 'PlayerTwo',
    emoji: '❤️',
    sender_id: '456',
    avatarData: {
      head: { id: 5, color: '#00ff00' },
      skinColor: '#000000'
    }
  }
];

const result = plainToInstance(ReactionDto, reactionPayload, { excludeExtraneousValues: true });
console.log('Reaction List with AvatarData:\n', JSON.stringify(result, null, 2));
"
Reaction List with AvatarData:
 [
  {
    "playerName": "PlayerOne",
    "emoji": "👍",
    "sender_id": "123",
    "avatarData": {
      "head": {
        "id": 1,
        "color": "#ffffff"
      },
      "skinColor": "#ffffff"
    }
  },
  {
    "playerName": "PlayerTwo",
    "emoji": "❤️",
    "sender_id": "456",
    "avatarData": {
      "head": {
        "id": 5,
        "color": "#00ff00"
      },
      "skinColor": "#000000"
    }
  }
]
[capomk@archlinux Altzone-Server]$

Change list

  • Adds new imports to addReaction.dto.ts just for the DTO in question, at least for the most part.
  • Adds the AvatarData as an optional DTO in the same file with the imported functionality included.
  • Similar setup on reaction.dto.ts as well.
  • Implements the avatarSchema on reaction.schema.ts.
  • baseChatService.ts and chat.service.ts were modified for the sole purpose of getting npm run build to pass. I followed the same setup that's been done on the previous parts of the async method, making sure to add the required fields to the class to make it work.

@codecov-alt

codecov-alt Bot commented Aug 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/chat/service/baseChat.service.ts 69.44% <ø> (ø)
src/chat/service/chat.service.ts 100.00% <100.00%> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tickBit tickBit left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work 👍 ! Approved.

@github-project-automation github-project-automation Bot moved this from Backlog to Done in Altzone-Server Aug 8, 2026
@tickBit
tickBit merged commit b51b6df into dev Aug 8, 2026
5 checks passed
@tickBit
tickBit deleted the 861-feature-request-add-avatardata-into-the-chat-reaction-data branch August 8, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Feature request: Add AvatarData into the chat reaction data.

2 participants