File

src/modules/user/dtos/user.dto.ts

Extends

AbstractDto

Index

Properties

Constructor

constructor(user: UserEntity)
Parameters :
Name Type Optional
user UserEntity No

Properties

Readonly Optional avatar
Type : string
Decorators :
@ApiProperty()
Readonly Optional email
Type : string
Decorators :
@ApiPropertyOptional()
Readonly firstName
Type : string
Decorators :
@ApiProperty()
Readonly lastName
Type : string
Decorators :
@ApiProperty()
Readonly Optional partner
Type : UserPartnerDto
Decorators :
@ApiPropertyOptional({type: UserPartnerDto})
@IsOptional()
Readonly Optional userAuth
Type : UserAuthDto
Decorators :
@ApiPropertyOptional({type: UserAuthDto})
@IsOptional()
Readonly Optional userConfig
Type : UserConfigDto
Decorators :
@ApiPropertyOptional({type: UserConfigDto})
@IsOptional()
Readonly uuid
Type : string
Inherited from AbstractDto
Defined in AbstractDto:4
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsOptional } from 'class-validator';
import { AbstractDto } from 'common/dtos';
import { UserEntity } from 'modules/user/entities';
import { UserPartnerDto } from './user-partner.dto'
import { UserAuthDto } from './user-auth.dto';
import { UserConfigDto } from './user-config.dto';

export class UserDto extends AbstractDto {
  @ApiProperty()
  readonly firstName: string;

  @ApiProperty()
  readonly lastName: string;

  @ApiPropertyOptional()
  readonly email?: string;

  @ApiProperty()
  readonly avatar?: string;

  @ApiPropertyOptional({ type: UserAuthDto })
  @IsOptional()
  readonly userAuth?: UserAuthDto;

  @ApiPropertyOptional({ type: UserPartnerDto })
  @IsOptional()
  readonly partner?: UserPartnerDto;

  @ApiPropertyOptional({ type: UserConfigDto })
  @IsOptional()
  readonly userConfig?: UserConfigDto;

  constructor(user: UserEntity) {
    super(user);
    this.firstName = user.firstName;
    this.lastName = user.lastName;
    this.email = user.email;
    this.avatar = user.avatar;
    this.partner = user.partner?.toDto();
    this.userAuth = user.userAuth?.toDto();
    this.userConfig = user.userConfig?.toDto();
  }
}

result-matching ""

    No results matching ""