From 77d269cbc1d176c32bc91f61d02c061f6d4b6d98 Mon Sep 17 00:00:00 2001 From: CapoMK25 Date: Wed, 22 Jul 2026 17:00:47 +0300 Subject: [PATCH 1/2] Addressed the legacy Avatar situation with Transform --- src/player/dto/avatar.dto.ts | 22 +++++++++++----------- src/player/schemas/avatar.schema.ts | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/player/dto/avatar.dto.ts b/src/player/dto/avatar.dto.ts index 5db0133d..188d200b 100644 --- a/src/player/dto/avatar.dto.ts +++ b/src/player/dto/avatar.dto.ts @@ -1,4 +1,4 @@ -import { Expose, Type } from 'class-transformer'; +import { Expose, Type, Transform } from 'class-transformer'; import { IsNumber, IsHexColor, ValidateNested } from 'class-validator'; export class AvatarPieceDto { @@ -28,8 +28,8 @@ export class AvatarDto { * Configuration for the avatar's head shape and base. * @example {AvatarPieceDto} */ - @Expose() + @Transform(({ value }) => (typeof value === 'number' ? { id: value, color: '#ffffff' } : value)) @ValidateNested() @Type(() => AvatarPieceDto) head: AvatarPieceDto; @@ -38,8 +38,8 @@ export class AvatarDto { * Configuration for the avatar's hairstyle and color. * @type {AvatarPieceDto} */ - @Expose() + @Transform(({ value }) => (typeof value === 'number' ? { id: value, color: '#ffffff' } : value)) @ValidateNested() @Type(() => AvatarPieceDto) hair: AvatarPieceDto; @@ -48,8 +48,8 @@ export class AvatarDto { * Configuration for the avatar's eye shape and iris color. * @type {AvatarPieceDto} */ - @Expose() + @Transform(({ value }) => (typeof value === 'number' ? { id: value, color: '#ffffff' } : value)) @ValidateNested() @Type(() => AvatarPieceDto) eyes: AvatarPieceDto; @@ -58,8 +58,8 @@ export class AvatarDto { * Configuration for the avatar's nose structure. * @type {AvatarPieceDto} */ - @Expose() + @Transform(({ value }) => (typeof value === 'number' ? { id: value, color: '#ffffff' } : value)) @ValidateNested() @Type(() => AvatarPieceDto) nose: AvatarPieceDto; @@ -68,8 +68,8 @@ export class AvatarDto { * Configuration for the avatar's mouth and lip shape. * @type {AvatarPieceDto} */ - @Expose() + @Transform(({ value }) => (typeof value === 'number' ? { id: value, color: '#ffffff' } : value)) @ValidateNested() @Type(() => AvatarPieceDto) mouth: AvatarPieceDto; @@ -78,8 +78,8 @@ export class AvatarDto { * Configuration for the avatar's eyebrow shape and thickness. * @type {AvatarPieceDto} */ - @Expose() + @Transform(({ value }) => (typeof value === 'number' ? { id: value, color: '#ffffff' } : value)) @ValidateNested() @Type(() => AvatarPieceDto) eyebrows: AvatarPieceDto; @@ -88,8 +88,8 @@ export class AvatarDto { * Configuration for the avatar's upper body clothing or outfit. * @type {AvatarPieceDto} */ - @Expose() + @Transform(({ value }) => (typeof value === 'number' ? { id: value, color: '#ffffff' } : value)) @ValidateNested() @Type(() => AvatarPieceDto) clothes: AvatarPieceDto; @@ -98,8 +98,8 @@ export class AvatarDto { * Configuration for the avatar's footwear. * @type {AvatarPieceDto} */ - @Expose() + @Transform(({ value }) => (typeof value === 'number' ? { id: value, color: '#ffffff' } : value)) @ValidateNested() @Type(() => AvatarPieceDto) feet: AvatarPieceDto; @@ -108,8 +108,8 @@ export class AvatarDto { * Configuration for the avatar's hand features or gloves. * @type {AvatarPieceDto} */ - @Expose() + @Transform(({ value }) => (typeof value === 'number' ? { id: value, color: '#ffffff' } : value)) @ValidateNested() @Type(() => AvatarPieceDto) hands: AvatarPieceDto; @@ -121,4 +121,4 @@ export class AvatarDto { @Expose() @IsHexColor() skinColor: string; -} +} \ No newline at end of file diff --git a/src/player/schemas/avatar.schema.ts b/src/player/schemas/avatar.schema.ts index 6c9bbe94..513cc222 100644 --- a/src/player/schemas/avatar.schema.ts +++ b/src/player/schemas/avatar.schema.ts @@ -52,4 +52,4 @@ export class Avatar { skinColor: string; } -export const AvatarSchema = SchemaFactory.createForClass(Avatar); +export const AvatarSchema = SchemaFactory.createForClass(Avatar); \ No newline at end of file From 515575ff5a6b386768e0152a351aa7185ab38540 Mon Sep 17 00:00:00 2001 From: Mikhail Deriabin Date: Sat, 25 Jul 2026 12:37:32 +0300 Subject: [PATCH 2/2] add ignore patterns to Codecov for files that does not need to be tested --- codecov.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/codecov.yml b/codecov.yml index 63fe9641..5bf9697e 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,3 +1,11 @@ +ignore: + - "src/__tests__" + - "**/*.dto.ts" + - "**/*.controller.ts" + - "**/*.schema.ts" + - "**/*.enum.ts" + - "**/*.module.ts" + coverage: status: project: