mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-17 02:01:29 +10:00
31 lines
636 B
TypeScript
31 lines
636 B
TypeScript
import { Transform } from 'class-transformer';
|
|
import { IsEmail, IsNotEmpty, IsString, Matches, MinLength } from 'class-validator';
|
|
|
|
export class CreateUserDto {
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
name: string;
|
|
|
|
@MinLength(3)
|
|
@Transform(({ value }) => (value as string).toLowerCase().replace(/[ ]/gi, '-'))
|
|
@Matches(/^[a-z0-9-]+$/, {
|
|
message: 'username can contain only lowercase characters, numbers and hyphens',
|
|
})
|
|
username: string;
|
|
|
|
@IsEmail()
|
|
@IsNotEmpty()
|
|
email: string;
|
|
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
password: string;
|
|
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
provider: 'email';
|
|
|
|
@IsString()
|
|
resetToken?: string;
|
|
}
|