Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

1.3 KB
Raw Blame
import { ApiProperty } from '@nestjs/swagger'
import {
  IsEmail,
  IsNotEmpty,
  IsBoolean,
  MaxLength,
  MinLength,
} from 'class-validator'

export class RegisterRequestDto {
  @ApiProperty({
    description: 'User email',
    example: '[email protected]',
    maxLength: 254,
    minLength: 6,
  })
  @IsEmail({}, { message: 'Please enter the valid email.' })
  public readonly email: string

  @ApiProperty({
    description: 'User password',
    example: '%d7*c4W45p',
    maxLength: 72,
    minLength: 8,
  })
  @MaxLength(72, { message: 'Max length is $constraint1 characters' })
  @MinLength(8, { message: 'Min length is $constraint1 characters' })
  public readonly password: string

  @ApiProperty({
    description: 'Check if password is leaked',
    example: true,
  })
  @IsNotEmpty({ message: 'This field is required.' })
  @IsBoolean({ message: 'Please enter the valid value (true or false).' })
  public readonly checkIfLeaked: boolean
}

export class RegisterResponseDto {
  @ApiProperty({
    description: 'Access token (JWT)',
  })
  public readonly accessToken: string

  @ApiProperty({
    description: 'Refresh token (JWT)',
  })
  public readonly refreshToken: string

  @ApiProperty({
    description: 'User entity',
  })
  user: object

  @ApiProperty({
    description: 'Total used monthly events',
  })
  totalMonthlyEvents: number
}