mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-08-25 13:49:40 +00:00
24 lines
966 B
TypeScript
24 lines
966 B
TypeScript
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;
|
|
}
|