Files
Reactive-Resume/server/src/users/dto/create-google-user.dto.ts
T
Amruth Pillai 9c1380f401 🚀 release v3.0.0
2022-03-06 22:48:29 +01:00

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';
}