File

src/users/dto/create-user.dto.ts

Index

Properties

Properties

Public captcha
Type : string
Decorators :
@IsNotEmpty()
Public email
Type : string
Decorators :
@IsEmail(undefined, {message: undefined})
@IsNotEmpty({message: undefined})
Public password
Type : string
Decorators :
@MinLength(8, {message: undefined})
@MaxLength(128, {message: undefined})
@IsNotEmpty({message: undefined})
Public username
Type : string
Decorators :
@MinLength(4, {message: undefined})
@MaxLength(16, {message: undefined})
@IsNotEmpty({message: undefined})
@IsUrlSafe()
import { IsEmail, IsNotEmpty, MaxLength, MinLength } from 'class-validator';
import { IsUrlSafe } from '../../common/decorators/urlsafe.decorator';
import { RegisterRespEnum } from '../../utils/enums/responses/register.enum';

export default class CreateUserDto {
  @IsEmail(undefined, {
    message: RegisterRespEnum.ERR_INVALID_EMAIL,
  })
  @IsNotEmpty({
    message: RegisterRespEnum.ERR_INVALID_EMAIL,
  })
  public email: string;

  @MinLength(4, {
    message: RegisterRespEnum.ERR_USERNAME_TOOSHORT,
  })
  @MaxLength(16, {
    message: RegisterRespEnum.ERR_USERNAME_TOOLONG,
  })
  @IsNotEmpty({
    message: RegisterRespEnum.ERR_USERNAME_INVALID,
  })
  @IsUrlSafe()
  public username: string;

  @MinLength(8, {
    message: RegisterRespEnum.ERR_PASSWORD_TOOSHORT,
  })
  @MaxLength(128, {
    message: RegisterRespEnum.ERR_PASSWORD_TOOLONG,
  })
  @IsNotEmpty({
    message: RegisterRespEnum.ERR_PASSWORD_INVALID,
  })
  public password: string;

  //controlled by guard
  @IsNotEmpty()
  public captcha: string;
}

results matching ""

    No results matching ""