import { ApiProperty } from '@nestjs/swagger' ; import { IsAlphanumeric , IsNotEmpty , Matches , Length } from 'class-validator' ; const passwordRegex = /((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/ ; export class ChangePasswordRequestDto { @ IsNotEmpty ( ) @ IsAlphanumeric ( ) @ ApiProperty ( { example : 'Hello123' , } ) currentPassword : string ; @ Matches ( passwordRegex , { message : 'Password too weak' } ) @ IsNotEmpty ( ) @ IsAlphanumeric ( ) @ Length ( 6 , 20 ) @ ApiProperty ( { example : 'Hello123' , } ) newPassword : string ; }