mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-08-26 06:09:41 +00:00
16 lines
697 B
TypeScript
16 lines
697 B
TypeScript
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;
|
|
}
|