프로필 카드 조회 API를 만들기에 앞서 프로필 카드 생성 API를 만들 때 사용했던 Profile 엔티티와 Repository를 사용하기 위해 terminal에서 merge하여 정보를 가져온다.
엔티티가 certificates와 profileCard 두개로 나뉘어짐에 따라 DTO 또한 두개로 나누어 만들었다.
AllArgsConstructor vs NoArgsConstructor
NoArgsConstructor는 아무 값도 받지 않는 생성자를 만들어 값을 입력받는다.
-> 프로필 카드 생성 시 생성자를 사용하여 빈 객체를 만들고 값을 입력받는다.
AllArgsConstructor는 모든 필드를 매개변수로 받는 생성자를 만든다.
-> 조회나 응답 DTO는 값을 직접 채워 반환히기 때문에 AllArgsConstructor
private CertificatesResponse certificates;
ProfileCardGetResponse 안에 CertificatesResponse 타입의 필드 하나를 넣겠다.
Json으로 보면
"certificates": {
"recentThree": ["컴퓨터 활용 능력 1급", "ADsP"],
"othersCount": 0
}
certificates 안에 여러 값이 들어가기 때문에 String이나 List가 아닌 새로운 DTO 객체로 만든 것