import { ApiProperty } from '@nestjs/swagger'; import { IsNotEmpty, IsString, Matches } from 'class-validator'; import { i18nValidationMessage as i18n } from 'nestjs-i18n'; import { PASSWORD_REGEX } from '~/auth/constants'; export class ChangePasswordRequestDto { @ApiProperty({ example: 'currentPassword@123' }) @IsString({ message: i18n('validation.IsString', { path: 'general', property: 'auth.currentPassword' }) }) @IsNotEmpty({ message: i18n('validation.IsNotEmpty', { path: 'general', property: 'auth.currentPassword' }) }) currentPassword!: string; @ApiProperty({ example: 'Abcd1234@' }) @Matches(PASSWORD_REGEX, { message: i18n('validation.Matches', { path: 'general', property: 'auth.newPassword' }), }) newPassword!: string; @ApiProperty({ example: 'Abcd1234@' }) @Matches(PASSWORD_REGEX, { message: i18n('validation.Matches', { path: 'general', property: 'auth.confirmNewPassword' }), }) confirmNewPassword!: string; }