깜놀하는 해므찌로

Angular Partial 활용 예시 본문

IT

Angular Partial 활용 예시

agnusdei1207 2023. 6. 12. 12:20
반응형
SMALL
export interface IUserDTO {
  id: string;
  kakaoId: string;
  nickname: string;
  createdAt: Date;
  updatedAt: Date;
  deletedAt: Date;
  blockedAt: Date;
}

1. 유저 인터페이스

 

export class UpdateUserDTO implements Partial<IUserDTO> {
  @ApiProperty({ example: 'user', description: '닉네임' })
  @IsOptional()
  nickname?: string;

  @ApiProperty({ example: '2023-01-01 00:00:00', description: '수정일' })
  @IsOptional()
  updatedAt?: Date;

  @ApiProperty({ example: '2023-01-01 00:00:00', description: '차단일' })
  @IsOptional()
  blockedAt?: Date;
}

2. Patial : generic 에 선언된 타입의 필드를 전부 optional 로 반환합니다.

반응형
LIST