import { ApiProperty } from '@nestjs/swagger'; import { IsNumberString, MaxLength, MinLength } from 'class-validator'; import { i18nValidationMessage as i18n } from 'nestjs-i18n'; const PASSCODE_LENGTH = 6; export class SetPasscodeRequestDto { @ApiProperty({ example: '123456' }) @IsNumberString( { no_symbols: true }, { message: i18n('validation.IsNumberString', { path: 'general', property: 'auth.passcode' }) }, ) @MinLength(PASSCODE_LENGTH, { message: i18n('validation.MinLength', { path: 'general', property: 'auth.passcode' }) }) @MaxLength(PASSCODE_LENGTH, { message: i18n('validation.MaxLength', { path: 'general', property: 'auth.passcode' }) }) passcode!: string; }