Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/player/dto/avatar.dto.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -121,4 +121,4 @@ export class AvatarDto {
@Expose()
@IsHexColor()
skinColor: string;
}
}
2 changes: 1 addition & 1 deletion src/player/schemas/avatar.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ export class Avatar {
skinColor: string;
}

export const AvatarSchema = SchemaFactory.createForClass(Avatar);
export const AvatarSchema = SchemaFactory.createForClass(Avatar);