auth/src/modules/authentication/interface/grpc-controllers/dtos/create-authentication.reque...

28 lines
607 B
TypeScript

import { Type } from 'class-transformer';
import {
ArrayMinSize,
IsArray,
IsNotEmpty,
IsString,
IsStrongPassword,
ValidateNested,
} from 'class-validator';
import { UsernameDto } from './username.dto';
import { STRONG_PASSWORD_OPTIONS } from '@modules/authentication/authentication.constants';
export class CreateAuthenticationRequestDto {
@IsString()
@IsNotEmpty()
userId: string;
@Type(() => UsernameDto)
@IsArray()
@ArrayMinSize(1)
@ValidateNested({ each: true })
usernames: UsernameDto[];
@IsStrongPassword(STRONG_PASSWORD_OPTIONS)
@IsNotEmpty()
password: string;
}