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!

920 B
Raw Blame
import { ApiProperty } from '@nestjs/swagger'
import { IsEmail, MinLength } from 'class-validator'
import { User } from '../../common/types'

export class LoginRequestDto {
  @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',
    minLength: 8,
  })
  @MinLength(8, { message: 'Min length is $constraint1 characters' })
  public readonly password: string
}

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

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

  @ApiProperty({
    description: 'User entity',
  })
  user: Partial<User>
}