File

libs/dtos/src/auth/response/SignInUserResponse.dto.ts

Description

components: schemas: UserResponseDto: type: object required: - id - email - password - firstName - lastName properties: id: type: string email: type: string firstName: type: string lastName: type: string example: id: 123 email: john@doe.com password: password firstName: John lastName: Doe

Index

Properties
Methods

Properties

accessToken
Type : string
Decorators :
@IsString()
email
Type : string
Decorators :
@IsString()
@IsEmail(undefined)
@IsNotEmpty()
firstName
Type : string
Decorators :
@IsNotEmpty()
@IsString()
Optional id
Type : number
Decorators :
@IsString()
lastName
Type : string
Decorators :
@IsNotEmpty()
@IsString()
refreshToken
Type : string
Decorators :
@IsString()

Methods

Static map
map(undefined: UserInterface)
Parameters :
Name Type Optional
UserInterface No
Returns : UserResponseDto
import { IsEmail, IsNotEmpty, IsString } from 'class-validator'
import { UserInterface } from '@isomera/interfaces'

/**
 * @openapi
 * components:
 *   schemas:
 *     UserResponseDto:
 *       type: object
 *       required:
 *         - id
 *         - email
 *         - password
 *         - firstName
 *         - lastName
 *       properties:
 *         id:
 *           type: string
 *         email:
 *           type: string
 *         firstName:
 *           type: string
 *         lastName:
 *           type: string
 *       example:
 *         id: 123
 *         email: john@doe.com
 *         password: password
 *         firstName: John
 *         lastName: Doe
 */
export class UserResponseDto {
  @IsString()
  id?: number

  @IsString()
  @IsEmail(undefined)
  @IsNotEmpty()
  email!: string

  @IsNotEmpty()
  @IsString()
  firstName!: string

  @IsNotEmpty()
  @IsString()
  lastName!: string

  @IsString()
  accessToken!: string

  @IsString()
  refreshToken!: string

  static map({
    email,
    firstName,
    lastName,
    id,
    accessToken,
    refreshToken
  }: UserInterface): UserResponseDto {
    return {
      email,
      firstName,
      lastName,
      id,
      accessToken: accessToken || '',
      refreshToken: refreshToken || ''
    }
  }
}

results matching ""

    No results matching ""