import { ApiProperty } from '@nestjs/swagger'; import { IsEnum, IsNotEmpty, IsNumber, IsPositive, IsString, IsUUID } from 'class-validator'; import { i18nValidationMessage as i18n } from 'nestjs-i18n'; import { GiftColor } from '~/gift/enums'; export class CreateGiftRequestDto { @ApiProperty({ example: 'Happy Birthday' }) @IsString({ message: i18n('validation.IsString', { path: 'general', property: 'gift.name' }) }) @IsNotEmpty({ message: i18n('validation.IsNotEmpty', { path: 'general', property: 'gift.name' }) }) name!: string; @ApiProperty({ example: 'Description of the gift' }) @IsString({ message: i18n('validation.IsString', { path: 'general', property: 'gift.description' }) }) @IsNotEmpty({ message: i18n('validation.IsNotEmpty', { path: 'general', property: 'gift.description' }) }) description!: string; @ApiProperty({ example: GiftColor.VIOLET }) @IsEnum(GiftColor, { message: i18n('validation.IsEnum', { path: 'general', property: 'gift.color' }) }) color!: GiftColor; @ApiProperty({ example: 100 }) @IsNumber({}, { message: i18n('validation.IsNumber', { path: 'general', property: 'gift.amount' }) }) @IsPositive({ message: i18n('validation.IsPositive', { path: 'general', property: 'gift.amount' }) }) amount!: number; @ApiProperty({ example: 'f7b9b1b0-0b3b-4b3b-8b3b-0b3b4b3b8b3b' }) @IsUUID('4', { message: i18n('validation.IsUUID', { path: 'general', property: 'gift.imageId' }) }) imageId!: string; @ApiProperty({ example: 'f7b9b1b0-0b3b-4b3b-8b3b-0b3b4b3b8b3b' }) @IsUUID('4', { message: i18n('validation.IsUUID', { path: 'general', property: 'gift.recipientId' }) }) recipientId!: string; }