libs/dtos/src/auth/response/SignInUserResponse.dto.ts
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
Properties |
|
Methods |
|
accessToken |
Type : string
|
Decorators :
@IsString()
|
Type : string
|
Decorators :
@IsString()
|
firstName |
Type : string
|
Decorators :
@IsNotEmpty()
|
Optional id |
Type : number
|
Decorators :
@IsString()
|
lastName |
Type : string
|
Decorators :
@IsNotEmpty()
|
refreshToken |
Type : string
|
Decorators :
@IsString()
|
Static map | |||||
map(undefined: UserInterface)
|
|||||
Parameters :
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 || ''
}
}
}