24 lines
469 B
TypeScript
24 lines
469 B
TypeScript
import { Field, InputType } from '@nestjs/graphql'
|
|
import { IsEmail, IsNotEmpty, IsString, Matches, MinLength } from 'class-validator'
|
|
|
|
@InputType()
|
|
export class CreateUserInput {
|
|
@Field(() => String)
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
@Matches(/^[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*$/)
|
|
name: string
|
|
|
|
@Field(() => String)
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
@IsEmail()
|
|
email: string
|
|
|
|
@Field(() => String)
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
@MinLength(8)
|
|
password: string
|
|
}
|