mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-13 22:37:14 +10:00
24 lines
554 B
TypeScript
24 lines
554 B
TypeScript
import { Transform } from 'class-transformer';
|
|
import { IsEmail, IsNotEmpty, IsString, Matches, MinLength } from 'class-validator';
|
|
|
|
export class CreateGoogleUserDto {
|
|
@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()
|
|
provider: 'google';
|
|
}
|